11 #ifndef BOOST_FUNCTION_BASE_HEADER 12 #define BOOST_FUNCTION_BASE_HEADER 33 #ifndef BOOST_NO_SFINAE 41 #if defined(BOOST_MSVC) 42 # pragma warning( push ) 43 # pragma warning( disable : 4793 ) // complaint about native code generation 44 # pragma warning( disable : 4127 ) // "conditional expression is constant" 48 #ifdef BOOST_NO_STD_TYPEINFO 50 # define BOOST_FUNCTION_STD_NS 52 # define BOOST_FUNCTION_STD_NS std 57 #if defined( BOOST_NO_TYPEID ) 58 # define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) ((X)==(Y)) 59 #elif defined(__GNUC__) \ 61 || ( defined(__sgi) && defined(__host_mips)) 63 # define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) \ 64 (std::strcmp((X).name(),(Y).name()) == 0) 66 # define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) ((X)==(Y)) 69 #if defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 && !defined(BOOST_STRICT_CONFIG) 70 # define BOOST_FUNCTION_TARGET_FIX(x) x 72 # define BOOST_FUNCTION_TARGET_FIX(x) 75 #if !BOOST_WORKAROUND(__BORLANDC__, < 0x5A0) 76 # define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \ 77 typename ::boost::enable_if_c<(::boost::type_traits::ice_not< \ 78 (::boost::is_integral<Functor>::value)>::value), \ 83 # define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \ 84 ::boost::enable_if_c<(::boost::type_traits::ice_not< \ 85 (::boost::is_integral<Functor>::value)>::value), \ 259 template <
typename F,
typename A>
269 F(static_cast<const F&>(f)),
270 A(static_cast<const A&>(f))
279 template<
typename Functor>
316 const functor_type* in_functor =
317 reinterpret_cast<const functor_type*
>(&in_buffer.
data);
318 new (
reinterpret_cast<void*
>(&out_buffer.
data)) functor_type(*in_functor);
321 functor_type*
f =
reinterpret_cast<functor_type*
>(&in_buffer.
data);
327 functor_type*
f =
reinterpret_cast<functor_type*
>(&out_buffer.
data);
345 template<
typename Functor>
378 const functor_type*
f =
379 static_cast<const functor_type*
>(in_buffer.
obj_ptr);
380 functor_type* new_f =
new functor_type(*f);
388 static_cast<functor_type*
>(out_buffer.
obj_ptr);
412 manager(in_buffer, out_buffer, op,
421 manager(in_buffer, out_buffer, op,
mpl::true_());
440 manager(in_buffer, out_buffer, op, tag_type());
446 template<
typename Functor,
typename Allocator>
474 typedef typename Allocator::template rebind<functor_wrapper_type>::other
475 wrapper_allocator_type;
482 const functor_wrapper_type*
f =
483 static_cast<const functor_wrapper_type*
>(in_buffer.
obj_ptr);
484 wrapper_allocator_type wrapper_allocator(static_cast<Allocator const &>(*f));
485 wrapper_allocator_pointer_type
copy = wrapper_allocator.allocate(1);
486 wrapper_allocator.construct(copy, *f);
489 functor_wrapper_type* new_f =
static_cast<functor_wrapper_type*
>(
copy);
496 functor_wrapper_type* victim =
497 static_cast<functor_wrapper_type*
>(in_buffer.
obj_ptr);
498 wrapper_allocator_type wrapper_allocator(static_cast<Allocator const &>(*victim));
499 wrapper_allocator.destroy(victim);
500 wrapper_allocator.deallocate(victim,1);
523 manager(in_buffer, out_buffer, op,
543 manager(in_buffer, out_buffer, op, tag_type());
552 #ifdef BOOST_NO_SFINAE 558 template<
typename Function,
typename Functor>
560 compare_equal(
const Function&
f,
const Functor&,
int, mpl::bool_<true>)
561 {
return f.empty(); }
563 template<
typename Function,
typename Functor>
565 compare_not_equal(
const Function& f,
const Functor&,
int,
567 {
return !f.empty(); }
569 template<
typename Function,
typename Functor>
571 compare_equal(
const Function& f,
const Functor&
g,
long,
579 template<
typename Function,
typename Functor>
582 int, mpl::bool_<false>)
589 template<
typename Function,
typename Functor>
591 compare_not_equal(
const Function& f,
const Functor& g,
long,
599 template<
typename Function,
typename Functor>
601 compare_not_equal(
const Function& f,
609 #endif // BOOST_NO_SFINAE 636 bool empty()
const {
return !vtable; }
649 template<
typename Functor>
652 if (!vtable)
return 0;
658 get_vtable()->manager(functor, type_result,
660 return static_cast<Functor*
>(type_result.
obj_ptr);
663 template<
typename Functor>
666 if (!vtable)
return 0;
672 get_vtable()->manager(functor, type_result,
676 return static_cast<const Functor*
>(type_result.
obj_ptr);
682 if (
const F* fp = this->
template target<F>())
690 #if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3 694 template<
typename Functor>
703 template<
typename Functor>
716 reinterpret_cast<std::size_t
>(vtable) & ~static_cast<std::size_t>(0x01));
720 return reinterpret_cast<std::size_t
>(vtable) & 0x01;
737 #ifndef BOOST_NO_SFINAE 763 #ifdef BOOST_NO_SFINAE 765 template<
typename Functor>
769 return detail::function::compare_equal(f, g, 0, integral());
772 template<
typename Functor>
776 return detail::function::compare_equal(f, g, 0, integral());
779 template<
typename Functor>
783 return detail::function::compare_not_equal(f, g, 0, integral());
786 template<
typename Functor>
790 return detail::function::compare_not_equal(f, g, 0, integral());
794 # if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) 798 template<
typename Functor>
807 template<
typename Functor>
816 template<
typename Functor>
825 template<
typename Functor>
835 template<
typename Functor>
840 return fp ==
g.get_pointer();
844 template<
typename Functor>
849 return g.get_pointer() == fp;
853 template<
typename Functor>
858 return fp !=
g.get_pointer();
862 template<
typename Functor>
867 return g.get_pointer() != fp;
871 #endif // Compiler supporting SFINAE 880 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1310) 895 #undef BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL 896 #undef BOOST_FUNCTION_COMPARE_TYPE_ID 898 #if defined(BOOST_MSVC) 899 # pragma warning( pop ) 902 #endif // BOOST_FUNCTION_BASE_HEADER
functor_wrapper(const functor_wrapper &f)
mpl::if_c<(is_reference_wrapper< F >::value), function_obj_ref_tag, ptr_or_obj_or_mem_tag >::type or_ref_tag
GLenum GLsizei const void * pointer
typedef void(APIENTRY *GLDEBUGPROC)(GLenum source
struct boost::detail::function::function_buffer::bound_memfunc_ptr_t bound_memfunc_ptr
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
struct boost::detail::function::function_buffer::type_t type
BOOST_FORCEINLINE T * get_pointer() const
static void manager(const function_buffer &in_buffer, function_buffer &out_buffer, functor_manager_operation_type op, function_obj_tag)
const detail::sp_typeinfo * type
bool has_empty_target(const function_base *f)
detail::function::vtable_base * vtable
static void manager(const function_buffer &in_buffer, function_buffer &out_buffer, functor_manager_operation_type op, mpl::true_)
static void manager(const function_buffer &in_buffer, function_buffer &out_buffer, functor_manager_operation_type op, member_ptr_tag)
static void manager(const function_buffer &in_buffer, function_buffer &out_buffer, functor_manager_operation_type op, mpl::true_)
static void manage(const function_buffer &in_buffer, function_buffer &out_buffer, functor_manager_operation_type op)
mpl::if_c<(is_pointer< F >::value), function_ptr_tag, function_obj_tag >::type ptr_or_obj_tag
bool operator!=(const function_base &f, detail::function::useless_clear_type *)
GLboolean GLboolean GLboolean GLboolean a
static void manage_ptr(const function_buffer &in_buffer, function_buffer &out_buffer, functor_manager_operation_type op)
detail::function::vtable_base * get_vtable() const
boost::core::typeinfo sp_typeinfo
struct boost::detail::function::function_buffer::obj_ref_t obj_ref
const detail::sp_typeinfo & target_type() const
functor_manager_operation_type
functor_wrapper(F f, A a)
const Functor * target() const
static void manage(const function_buffer &in_buffer, function_buffer &out_buffer, functor_manager_operation_type op)
static void manager(const function_buffer &in_buffer, function_buffer &out_buffer, functor_manager_operation_type op, function_obj_tag)
bool contains(const F &f) const
static void manager(const function_buffer &in_buffer, function_buffer &out_buffer, functor_manager_operation_type op, function_ptr_tag)
bool is_volatile_qualified
Contains a reference to an object of type T.
#define BOOST_SP_TYPEID(T)
bool function_equal(const F &f, const G &g)
static void manage_small(const function_buffer &in_buffer, function_buffer &out_buffer, functor_manager_operation_type op)
static void manager(const function_buffer &in_buffer, function_buffer &out_buffer, functor_manager_operation_type op, mpl::false_)
#define BOOST_FUNCTION_COMPARE_TYPE_ID(X, Y)
bool has_trivial_copy_and_destroy() const
mpl::if_c<(is_member_pointer< F >::value), member_ptr_tag, ptr_or_obj_tag >::type ptr_or_obj_or_mem_tag
static void manager(const function_buffer &in_buffer, function_buffer &out_buffer, functor_manager_operation_type op, mpl::false_)
#define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, Type)
#define BOOST_STATIC_CONSTANT(type, assignment)
static void manager(const function_buffer &in_buffer, function_buffer &out_buffer, functor_manager_operation_type op, function_ptr_tag)
static void manage(const function_buffer &in_buffer, function_buffer &out_buffer, functor_manager_operation_type op)
detail::function::function_buffer functor
bool operator==(const function_base &f, detail::function::useless_clear_type *)
void copy(void *dst, void const *src, size_t size)