FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GitHub Viewer

// Copyright Stefan Seefeld 2005. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include namespace python = boost::python; // An abstract base class class Base : public boost::noncopyable { public: virtual ~Base() {}; virtual std::string hello() = 0; }; // C++ derived class class CppDerived : public Base { public: virtual ~CppDerived() {} virtual std::string hello() { return "Hello from C++!";} }; // Familiar Boost.Python wrapper class for Base struct BaseWrap : Base, python::wrapper { virtual std::string hello() { #if BOOST_WORKAROUND(BOOST_MSVC, get_override("hello").ptr()); #else return this->get_override("hello")(); #endif } }; // Pack the Base class wrapper into a module BOOST_PYTHON_MODULE(embedded_hello) { python::class_ base("Base"); } void exec_test() { std::cout

Back | FazBrowse Home | New Git URL