mirror of
https://github.com/boostorg/python.git
synced 2026-01-22 05:22:45 +00:00
initial checkin
[SVN r11679]
This commit is contained in:
39
include/boost/python/detail/void_adaptor.hpp
Normal file
39
include/boost/python/detail/void_adaptor.hpp
Normal file
@@ -0,0 +1,39 @@
|
||||
// (C) Copyright David Abrahams 2001. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
// in all copies. This software is provided "as is" without express or implied
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
#ifndef VOID_ADAPTOR_DWA20011112_HPP
|
||||
# define VOID_ADAPTOR_DWA20011112_HPP
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
extern PyObject arbitrary_object;
|
||||
|
||||
template <class T>
|
||||
struct void_adaptor
|
||||
{
|
||||
typedef PyObject* result_type;
|
||||
|
||||
void_adaptor(T const& f)
|
||||
: m_f(f)
|
||||
{}
|
||||
|
||||
PyObject* operator()() const
|
||||
{
|
||||
m_f();
|
||||
return &arbitrary_object;
|
||||
}
|
||||
private:
|
||||
T m_f;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void_adaptor<T> make_void_adaptor(T const& f)
|
||||
{
|
||||
return void_adaptor<T>(f);
|
||||
}
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
#endif // VOID_ADAPTOR_DWA20011112_HPP
|
||||
|
||||
Reference in New Issue
Block a user