Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
bd4a5293
Commit
bd4a5293
authored
Jul 11, 2015
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more flexible function creation syntax
parent
38bd7113
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
35 deletions
+31
-35
.gitignore
+1
-0
include/pybind/cast.h
+6
-8
include/pybind/common.h
+1
-4
include/pybind/mpl.h
+11
-6
include/pybind/operators.h
+2
-5
include/pybind/pybind.h
+0
-0
include/pybind/pytypes.h
+8
-6
include/pybind/typeid.h
+2
-6
No files found.
.gitignore
View file @
bd4a5293
...
@@ -18,3 +18,4 @@ Debug
...
@@ -18,3 +18,4 @@ Debug
.vs
.vs
CTestTestfile.cmake
CTestTestfile.cmake
Testing
Testing
autogen
include/pybind/cast.h
View file @
bd4a5293
...
@@ -8,12 +8,11 @@
...
@@ -8,12 +8,11 @@
BSD-style license that can be found in the LICENSE file.
BSD-style license that can be found in the LICENSE file.
*/
*/
#if !defined(__PYBIND_CAST)
#pragma once
#define __PYBIND_CAST
#include
"pytypes.h"
#include
<pybind/pytypes.h>
#include
"mpl.h"
#include
<pybind/mpl.h>
#include
"typeid.h"
#include
<pybind/typeid.h>
#include <map>
#include <map>
#include <array>
#include <array>
...
@@ -474,10 +473,11 @@ TYPE_CASTER_PYTYPE(int_)
...
@@ -474,10 +473,11 @@ TYPE_CASTER_PYTYPE(int_)
TYPE_CASTER_PYTYPE
(
list
)
TYPE_CASTER_PYTYPE
(
list
)
TYPE_CASTER_PYTYPE
(
slice
)
TYPE_CASTER_PYTYPE
(
slice
)
TYPE_CASTER_PYTYPE
(
tuple
)
TYPE_CASTER_PYTYPE
(
tuple
)
TYPE_CASTER_PYTYPE
(
function
)
#undef TYPE_CASTER
#undef TYPE_CASTER
#undef TYPE_CASTER_NUMBER
#undef TYPE_CASTER_PYTYPE
#undef TYPE_CASTER_PYTYPE
#undef TYPE_CASTER_NUMBER
NAMESPACE_END
(
detail
)
NAMESPACE_END
(
detail
)
...
@@ -522,5 +522,3 @@ template <typename ... Args> inline object handle::call(Args&&... args_) {
...
@@ -522,5 +522,3 @@ template <typename ... Args> inline object handle::call(Args&&... args_) {
}
}
NAMESPACE_END
(
pybind
)
NAMESPACE_END
(
pybind
)
#endif
/* __PYBIND_CAST */
include/pybind/common.h
View file @
bd4a5293
...
@@ -7,8 +7,7 @@
...
@@ -7,8 +7,7 @@
BSD-style license that can be found in the LICENSE file.
BSD-style license that can be found in the LICENSE file.
*/
*/
#if !defined(__PYBIND_COMMON_H)
#pragma once
#define __PYBIND_COMMON_H
#if !defined(NAMESPACE_BEGIN)
#if !defined(NAMESPACE_BEGIN)
#define NAMESPACE_BEGIN(name) namespace name {
#define NAMESPACE_BEGIN(name) namespace name {
...
@@ -145,5 +144,3 @@ inline internals &get_internals();
...
@@ -145,5 +144,3 @@ inline internals &get_internals();
NAMESPACE_END
(
detail
)
NAMESPACE_END
(
detail
)
NAMESPACE_END
(
pybind
)
NAMESPACE_END
(
pybind
)
#endif
/* __PYBIND_COMMON_H */
include/pybind/mpl.h
View file @
bd4a5293
...
@@ -7,10 +7,9 @@
...
@@ -7,10 +7,9 @@
BSD-style license that can be found in the LICENSE file.
BSD-style license that can be found in the LICENSE file.
*/
*/
#if !defined(__PYBIND_MPL_H)
#pragma once
#define __PYBIND_MPL_H
#include
"common.h"
#include
<pybind/common.h>
#include <tuple>
#include <tuple>
NAMESPACE_BEGIN
(
pybind
)
NAMESPACE_BEGIN
(
pybind
)
...
@@ -80,7 +79,15 @@ template <> struct tuple_dispatch<void> {
...
@@ -80,7 +79,15 @@ template <> struct tuple_dispatch<void> {
NAMESPACE_END
(
detail
)
NAMESPACE_END
(
detail
)
/// For lambda functions delegate to their 'operator()'
/// For lambda functions delegate to their 'operator()'
template
<
typename
T
>
struct
function_traits
:
public
function_traits
<
typename
detail
::
make_function_type
<
T
>>
{
};
template
<
typename
T
>
struct
function_traits
:
function_traits
<
typename
detail
::
make_function_type
<
T
>>
{
};
/* Deal with reference arguments */
template
<
typename
ReturnType
,
typename
...
Args
>
struct
function_traits
<
ReturnType
(
*&
)(
Args
...)
>
:
function_traits
<
ReturnType
(
*
)(
Args
...)
>
{};
template
<
typename
ClassType
,
typename
ReturnType
,
typename
...
Args
>
struct
function_traits
<
ReturnType
(
ClassType
::*&
)(
Args
...)
>
:
function_traits
<
ReturnType
(
ClassType
::*
)(
Args
...)
>
{};
template
<
typename
ClassType
,
typename
ReturnType
,
typename
...
Args
>
struct
function_traits
<
ReturnType
(
ClassType
::*&
)(
Args
...)
const
>
:
function_traits
<
ReturnType
(
ClassType
::*
)(
Args
...)
const
>
{};
/// Type traits for function pointers
/// Type traits for function pointers
template
<
typename
ReturnType
,
typename
...
Args
>
template
<
typename
ReturnType
,
typename
...
Args
>
...
@@ -186,5 +193,3 @@ struct function_traits<std::function<ReturnType(Args...)>> {
...
@@ -186,5 +193,3 @@ struct function_traits<std::function<ReturnType(Args...)>> {
NAMESPACE_END
(
mpl
)
NAMESPACE_END
(
mpl
)
NAMESPACE_END
(
pybind
)
NAMESPACE_END
(
pybind
)
#endif
/* __PYBIND_MPL_H */
include/pybind/operators.h
View file @
bd4a5293
...
@@ -7,10 +7,9 @@
...
@@ -7,10 +7,9 @@
BSD-style license that can be found in the LICENSE file.
BSD-style license that can be found in the LICENSE file.
*/
*/
#if !defined(__PYBIND_OPERATOR)
#pragma once
#define __PYBIND_OPERATOR
#include
"pybind.h"
#include
<pybind/pybind.h>
#include <type_traits>
#include <type_traits>
NAMESPACE_BEGIN
(
pybind
)
NAMESPACE_BEGIN
(
pybind
)
...
@@ -147,5 +146,3 @@ NAMESPACE_END(detail)
...
@@ -147,5 +146,3 @@ NAMESPACE_END(detail)
using
detail
::
self
;
using
detail
::
self
;
NAMESPACE_END
(
pybind
)
NAMESPACE_END
(
pybind
)
#endif
/* __PYBIND_OPERATOR */
include/pybind/pybind.h
View file @
bd4a5293
This diff is collapsed.
Click to expand it.
include/pybind/pytypes.h
View file @
bd4a5293
...
@@ -7,10 +7,9 @@
...
@@ -7,10 +7,9 @@
BSD-style license that can be found in the LICENSE file.
BSD-style license that can be found in the LICENSE file.
*/
*/
#if !defined(__PYBIND_PYTYPES_H)
#pragma once
#define __PYBIND_PYTYPES_H
#include
"common.h"
#include
<pybind/common.h>
#include <utility>
#include <utility>
NAMESPACE_BEGIN
(
pybind
)
NAMESPACE_BEGIN
(
pybind
)
...
@@ -208,7 +207,7 @@ inline detail::accessor handle::attr(const char *key) { return detail::accessor(
...
@@ -208,7 +207,7 @@ inline detail::accessor handle::attr(const char *key) { return detail::accessor(
#define PYTHON_OBJECT_DEFAULT(Name, Parent, CheckFun) \
#define PYTHON_OBJECT_DEFAULT(Name, Parent, CheckFun) \
PYTHON_OBJECT(Name, Parent, CheckFun) \
PYTHON_OBJECT(Name, Parent, CheckFun) \
Name() :
objec
t() { }
Name() :
Paren
t() { }
class
str
:
public
object
{
class
str
:
public
object
{
public
:
public
:
...
@@ -295,6 +294,11 @@ public:
...
@@ -295,6 +294,11 @@ public:
void
append
(
const
object
&
object
)
{
PyList_Append
(
m_ptr
,
(
PyObject
*
)
object
.
ptr
());
}
void
append
(
const
object
&
object
)
{
PyList_Append
(
m_ptr
,
(
PyObject
*
)
object
.
ptr
());
}
};
};
class
function
:
public
object
{
public
:
PYTHON_OBJECT_DEFAULT
(
function
,
object
,
PyFunction_Check
)
};
class
buffer
:
public
object
{
class
buffer
:
public
object
{
public
:
public
:
PYTHON_OBJECT_DEFAULT
(
buffer
,
object
,
PyObject_CheckBuffer
)
PYTHON_OBJECT_DEFAULT
(
buffer
,
object
,
PyObject_CheckBuffer
)
...
@@ -335,5 +339,3 @@ inline internals &get_internals() {
...
@@ -335,5 +339,3 @@ inline internals &get_internals() {
}
}
NAMESPACE_END
(
detail
)
NAMESPACE_END
(
detail
)
NAMESPACE_END
(
pybind
)
NAMESPACE_END
(
pybind
)
#endif
/* __PYBIND_PYTYPES_H */
include/pybind/typeid.h
View file @
bd4a5293
...
@@ -7,10 +7,9 @@
...
@@ -7,10 +7,9 @@
BSD-style license that can be found in the LICENSE file.
BSD-style license that can be found in the LICENSE file.
*/
*/
#if !defined(__PYBIND_TYPEID_H)
#pragma once
#define __PYBIND_TYPEID_H
#include
"common.h"
#include
<pybind/typeid.h>
#include <cstdio>
#include <cstdio>
#include <cstdlib>
#include <cstdlib>
#if defined(__GNUG__)
#if defined(__GNUG__)
...
@@ -48,6 +47,3 @@ template <typename T> static std::string type_id() {
...
@@ -48,6 +47,3 @@ template <typename T> static std::string type_id() {
}
}
NAMESPACE_END
(
pybind
)
NAMESPACE_END
(
pybind
)
#endif
/* __PYBIND_TYPEID_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment