-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
64 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
#include "c2py/c2py.hpp" | ||
|
||
/// A wonderful little class | ||
class my_class{ | ||
class my_class { | ||
int a, b; | ||
|
||
public: | ||
my_class(int a_, int b_) : a(a_), b(b_) {} | ||
int f(int u) const { return u + a;} | ||
my_class(int a_, int b_) : a(a_), b(b_) {} | ||
int f(int u) const { return u + a; } | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
#include "c2py/c2py.hpp" | ||
|
||
/// A wonderful little class | ||
class my_class{ | ||
class my_class { | ||
int a, b; | ||
|
||
public: | ||
my_class(int a_, int b_) : a(a_), b(b_) {} | ||
my_class(int a_, int b_) : a(a_), b(b_) {} | ||
|
||
int f(int u) const { return u + a;} | ||
int f(int u) const { return u + a; } | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
#include <c2py/c2py.hpp> | ||
|
||
int f(auto x) { return 1;} // a generic (template) function | ||
|
||
namespace c2py_module { | ||
// ... | ||
namespace add { | ||
// function f in python dispatching the 2 instantiations. | ||
auto f = c2py::dispatch<::f<int>, ::f<double>>; | ||
} | ||
} | ||
|
||
|
||
int f(auto x) { return 1; } // a generic (template) function | ||
|
||
namespace c2py_module { | ||
// ... | ||
namespace add { | ||
// function f in python dispatching the 2 instantiations. | ||
auto f = c2py::dispatch<::f<int>, ::f<double>>; | ||
} // namespace add | ||
} // namespace c2py_module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
#include <c2py/c2py.hpp> | ||
|
||
template<typename T> | ||
struct A { | ||
template <typename T> struct A { | ||
T x; | ||
}; | ||
|
||
namespace c2py_module { | ||
// ... | ||
namespace add { | ||
using Ai = A<int>; | ||
using Ad = A<double>; | ||
} | ||
} | ||
|
||
|
||
namespace c2py_module { | ||
// ... | ||
namespace add { | ||
using Ai = A<int>; | ||
using Ad = A<double>; | ||
} // namespace add | ||
} // namespace c2py_module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
#include <c2py/c2py.hpp> | ||
|
||
double *make_raw_pointer(long size) { return new double[size]; } | ||
|
||
double * make_raw_pointer(long size) { return new double[size];} | ||
|
||
|
||
void f(FILE * x){} | ||
|
||
|
||
|
||
void f(FILE *x) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
#include <c2py/c2py.hpp> | ||
|
||
int g() { return 8;} | ||
int g() { return 8; } | ||
|
||
namespace N { | ||
int f(int x) { return -x;} | ||
namespace N { | ||
int f(int x) { return -x; } | ||
|
||
struct a_class{ | ||
struct a_class { | ||
// ... | ||
}; | ||
struct hidden{ | ||
|
||
struct hidden { | ||
//... | ||
}; | ||
} | ||
} // namespace N | ||
|
||
namespace c2py_module { | ||
auto match_names = "N::.*"; // match functions and names in namespace N | ||
auto match_names = "N::.*"; // match functions and names in namespace N | ||
auto reject_names = "N::hidden"; // reject the specific name "hidden" in namespace N | ||
} | ||
|
||
|
||
} // namespace c2py_module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,3 @@ struct A { | |
double x; | ||
std::string s; | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters