<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          pybind11C++ 的 Python 綁定

          聯(lián)合創(chuàng)作 · 2023-09-28 12:49

          pybind11 可實現(xiàn) C++11 和 Python 之間的無縫操作。

          pybind11 是一個輕量級的只包含一組頭文件的 C++ 庫,可以在 Python 中使用 C++ 類型。主要用于創(chuàng)建已有 C++ 代碼的 Python 封裝版本。其目的和語法類似于 Boost.Python 庫。為什么要創(chuàng)建這個項目的原因就是因為 Boost 。作者認為 Boost 很大很復雜。而目前的 C++11 兼容的編譯器使用已經(jīng)非常廣泛,所以希望開發(fā)一個更輕量級更具備兼容性的項目。

          除去注釋之外,該項目的核心頭文件只有 2500 行左右代碼,依賴于 Python (2.7 或者 3.x) 和標準 C++ 庫。這么精簡的實現(xiàn)有賴于新的 C++11 語言特性。特別是元組、Lambda 函數(shù)以及可變模板。自從項目創(chuàng)建以來,其增長已經(jīng)超過了 Boost.Python。

          核心特性

          • Functions accepting and returning custom data structures per value, reference, or pointer

          • Instance methods and static methods

          • Overloaded functions

          • Instance attributes and static attributes

          • Exceptions

          • Enumerations

          • Callbacks

          • Custom operators

          • STL data structures

          • Iterators and ranges

          • Smart pointers with reference counting like std::shared_ptr

          • Internal references with correct reference counting

          • C++ classes with virtual (and pure virtual) methods can be extended in Python

          支持的編譯器:

          1. Clang/LLVM (any non-ancient version with C++11 support)

          2. GCC (any non-ancient version with C++11 support)

          3. Microsoft Visual Studio 2015 or newer

          4. Intel C++ compiler v15 or newer

          瀏覽 24
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  91人妻综合 | 成人做爰A片免费播放金桔视频 | 青娱乐免费操逼视频 | 亚洲精品一二三四区 | 六月婷婷五月丁香 |