Add example to GoInterface
This commit is contained in:
parent
e32c9f22f2
commit
4207d33d79
1 changed files with 21 additions and 0 deletions
21
examples/src/go_interface.cpp
Normal file
21
examples/src/go_interface.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include <utempl/go_interface.hpp>
|
||||
#include <fmt/core.h>
|
||||
|
||||
struct SomeInterfaceImpl {
|
||||
int a;
|
||||
int b;
|
||||
};
|
||||
using SomeInterface = utempl::GoInterface<SomeInterfaceImpl>;
|
||||
struct SomeStruct {
|
||||
short a;
|
||||
short b;
|
||||
};
|
||||
|
||||
inline auto Func(SomeInterface arg) {
|
||||
fmt::print("{} {}\n", arg.a, arg.b);
|
||||
};
|
||||
|
||||
|
||||
auto main() -> int {
|
||||
Func(SomeStruct{42, 300});
|
||||
};
|
Loading…
Reference in a new issue