mirror of
https://github.com/boostorg/bind.git
synced 2026-01-29 09:50:15 +01:00
189 lines
3.4 KiB
C++
189 lines
3.4 KiB
C++
#ifndef BOOST_MEM_FN_HPP_INCLUDED
|
|
#define BOOST_MEM_FN_HPP_INCLUDED
|
|
|
|
#if _MSC_VER+0 >= 1020
|
|
#pragma once
|
|
#endif
|
|
|
|
//
|
|
// mem_fn.hpp - a generalization of std::mem_fun[_ref]
|
|
//
|
|
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
|
// Copyright (c) 2001 David Abrahams
|
|
//
|
|
// 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.
|
|
//
|
|
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
|
|
//
|
|
|
|
#include <boost/config.hpp>
|
|
|
|
namespace boost
|
|
{
|
|
|
|
// get_pointer(p) extracts a ->* capable pointer from p
|
|
|
|
template<class T> T * get_pointer(T * p)
|
|
{
|
|
return p;
|
|
}
|
|
|
|
// implementation of get_pointer for boost::shared_ptr
|
|
// this will probably migrate to boost/shared_ptr.hpp
|
|
|
|
template<class T> class shared_ptr;
|
|
|
|
template<class T> T * get_pointer(shared_ptr<T> const & p)
|
|
{
|
|
return p.get();
|
|
}
|
|
|
|
#ifdef BOOST_NO_VOID_RETURNS
|
|
|
|
namespace _mfi // mem_fun_impl
|
|
{
|
|
|
|
template<class V> struct mf
|
|
{
|
|
|
|
#define BOOST_MEM_FN_RETURN return
|
|
|
|
#define BOOST_MEM_FN_NAME(X) inner_##X
|
|
#define BOOST_MEM_FN_CC
|
|
|
|
#include <boost/bind/mem_fn_template.hpp>
|
|
|
|
#undef BOOST_MEM_FN_CC
|
|
#undef BOOST_MEM_FN_NAME
|
|
|
|
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
|
|
|
#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
|
|
#define BOOST_MEM_FN_CC __stdcall
|
|
|
|
#include <boost/bind/mem_fn_template.hpp>
|
|
|
|
#undef BOOST_MEM_FN_CC
|
|
#undef BOOST_MEM_FN_NAME
|
|
|
|
#endif
|
|
|
|
#undef BOOST_MEM_FN_RETURN
|
|
|
|
}; // struct mf<V>
|
|
|
|
template<> struct mf<void>
|
|
{
|
|
|
|
#define BOOST_MEM_FN_RETURN
|
|
|
|
#define BOOST_MEM_FN_NAME(X) inner_##X
|
|
#define BOOST_MEM_FN_CC
|
|
|
|
#include <boost/bind/mem_fn_template.hpp>
|
|
|
|
#undef BOOST_MEM_FN_CC
|
|
#undef BOOST_MEM_FN_NAME
|
|
|
|
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
|
|
|
#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
|
|
#define BOOST_MEM_FN_CC __stdcall
|
|
|
|
#include <boost/bind/mem_fn_template.hpp>
|
|
|
|
#undef BOOST_MEM_FN_CC
|
|
#undef BOOST_MEM_FN_NAME
|
|
|
|
#endif
|
|
|
|
#undef BOOST_MEM_FN_RETURN
|
|
|
|
}; // struct mf<void>
|
|
|
|
#define BOOST_MEM_FN_NAME(X) X
|
|
#define BOOST_MEM_FN_NAME2(X) inner_##X
|
|
#define BOOST_MEM_FN_CC
|
|
|
|
#include <boost/bind/mem_fn_vw.hpp>
|
|
|
|
#undef BOOST_MEM_FN_NAME
|
|
#undef BOOST_MEM_FN_NAME2
|
|
#undef BOOST_MEM_FN_CC
|
|
|
|
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
|
|
|
#define BOOST_MEM_FN_NAME(X) X##_stdcall
|
|
#define BOOST_MEM_FN_NAME2(X) inner_##X##_stdcall
|
|
#define BOOST_MEM_FN_CC __stdcall
|
|
|
|
#include <boost/bind/mem_fn_vw.hpp>
|
|
|
|
#undef BOOST_MEM_FN_NAME
|
|
#undef BOOST_MEM_FN_NAME2
|
|
#undef BOOST_MEM_FN_CC
|
|
|
|
#endif
|
|
|
|
} // namespace _mfi
|
|
|
|
#else // #ifdef BOOST_NO_VOID_RETURNS
|
|
|
|
namespace _mfi
|
|
{
|
|
|
|
#define BOOST_MEM_FN_RETURN return
|
|
|
|
#define BOOST_MEM_FN_NAME(X) X
|
|
#define BOOST_MEM_FN_CC
|
|
|
|
#include <boost/bind/mem_fn_template.hpp>
|
|
|
|
#undef BOOST_MEM_FN_CC
|
|
#undef BOOST_MEM_FN_NAME
|
|
|
|
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
|
|
|
#define BOOST_MEM_FN_NAME(X) X##_stdcall
|
|
#define BOOST_MEM_FN_CC __stdcall
|
|
|
|
#include <boost/bind/mem_fn_template.hpp>
|
|
|
|
#undef BOOST_MEM_FN_CC
|
|
#undef BOOST_MEM_FN_NAME
|
|
|
|
#endif
|
|
|
|
#undef BOOST_MEM_FN_RETURN
|
|
|
|
} // namespace _mfi
|
|
|
|
#endif // #ifdef BOOST_NO_VOID_RETURNS
|
|
|
|
#define BOOST_MEM_FN_NAME(X) X
|
|
#define BOOST_MEM_FN_CC
|
|
|
|
#include <boost/bind/mem_fn_cc.hpp>
|
|
|
|
#undef BOOST_MEM_FN_NAME
|
|
#undef BOOST_MEM_FN_CC
|
|
|
|
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
|
|
|
|
#define BOOST_MEM_FN_NAME(X) X##_stdcall
|
|
#define BOOST_MEM_FN_CC __stdcall
|
|
|
|
#include <boost/bind/mem_fn_cc.hpp>
|
|
|
|
#undef BOOST_MEM_FN_NAME
|
|
#undef BOOST_MEM_FN_CC
|
|
|
|
#endif
|
|
|
|
} // namespace boost
|
|
|
|
#endif // #ifndef BOOST_MEM_FN_HPP_INCLUDED
|