Files
boost_bind/include/boost/mem_fn.hpp
T

192 lines
3.6 KiB
C++
Raw Normal View History

2001-09-04 17:16:30 +00:00
#ifndef BOOST_MEM_FN_HPP_INCLUDED
#define BOOST_MEM_FN_HPP_INCLUDED
2001-11-10 19:18:58 +00:00
#if _MSC_VER+0 >= 1020
2001-09-04 17:16:30 +00:00
#pragma once
#endif
//
// mem_fn.hpp - a generalization of std::mem_fun[_ref]
//
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
2001-11-14 23:47:09 +00:00
// Copyright (c) 2001 David Abrahams
2001-09-04 17:16:30 +00:00
//
// 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.
//
2001-11-10 19:18:58 +00:00
#include <boost/config.hpp>
2001-09-04 17:16:30 +00:00
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();
}
// Void return workaround temporarily disabled on MSVC 6
// causes internal compiler errors with debug info enabled
#if defined(BOOST_NO_VOID_RETURNS)
2001-11-20 17:05:56 +00:00
2001-09-04 17:16:30 +00:00
namespace _mfi // mem_fun_impl
{
2001-11-20 17:05:56 +00:00
template<class V> struct mf
2001-09-04 17:16:30 +00:00
{
2001-11-20 17:05:56 +00:00
#define BOOST_MEM_FN_RETURN return
2001-11-14 23:47:09 +00:00
2001-11-20 17:05:56 +00:00
#define BOOST_MEM_FN_NAME(X) inner_##X
#define BOOST_MEM_FN_CC
2001-11-14 23:47:09 +00:00
2001-11-20 17:05:56 +00:00
#include <boost/bind/mem_fn_template.hpp>
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#undef BOOST_MEM_FN_CC
#undef BOOST_MEM_FN_NAME
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
#define BOOST_MEM_FN_CC __stdcall
2001-11-14 23:47:09 +00:00
2001-11-20 17:05:56 +00:00
#include <boost/bind/mem_fn_template.hpp>
2001-11-14 23:47:09 +00:00
2001-11-20 17:05:56 +00:00
#undef BOOST_MEM_FN_CC
#undef BOOST_MEM_FN_NAME
2001-11-14 23:47:09 +00:00
#endif
2001-11-20 17:05:56 +00:00
#undef BOOST_MEM_FN_RETURN
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
}; // struct mf<V>
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
template<> struct mf<void>
2001-09-04 17:16:30 +00:00
{
2001-11-20 17:05:56 +00:00
#define BOOST_MEM_FN_RETURN
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#define BOOST_MEM_FN_NAME(X) inner_##X
#define BOOST_MEM_FN_CC
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#include <boost/bind/mem_fn_template.hpp>
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#undef BOOST_MEM_FN_CC
#undef BOOST_MEM_FN_NAME
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
#define BOOST_MEM_FN_CC __stdcall
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#include <boost/bind/mem_fn_template.hpp>
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#undef BOOST_MEM_FN_CC
#undef BOOST_MEM_FN_NAME
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#endif
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#undef BOOST_MEM_FN_RETURN
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
}; // struct mf<void>
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#define BOOST_MEM_FN_NAME(X) X
#define BOOST_MEM_FN_NAME2(X) inner_##X
#define BOOST_MEM_FN_CC
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#include <boost/bind/mem_fn_vw.hpp>
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#undef BOOST_MEM_FN_NAME
#undef BOOST_MEM_FN_NAME2
#undef BOOST_MEM_FN_CC
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#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
2001-09-04 17:16:30 +00:00
#endif
2001-09-04 17:16:30 +00:00
} // namespace _mfi
2001-11-20 17:05:56 +00:00
#else // #ifdef BOOST_NO_VOID_RETURNS
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
namespace _mfi
{
2001-11-14 23:47:09 +00:00
2001-11-20 17:05:56 +00:00
#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>
2001-11-10 19:18:58 +00:00
#undef BOOST_MEM_FN_CC
2001-11-20 17:05:56 +00:00
#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
2001-11-10 19:18:58 +00:00
#endif
2001-11-20 17:05:56 +00:00
#undef BOOST_MEM_FN_RETURN
} // namespace _mfi
#endif // #ifdef BOOST_NO_VOID_RETURNS
#define BOOST_MEM_FN_NAME(X) X
2001-11-10 19:18:58 +00:00
#define BOOST_MEM_FN_CC
2001-11-20 17:05:56 +00:00
2001-11-10 19:18:58 +00:00
#include <boost/bind/mem_fn_cc.hpp>
2001-11-20 17:05:56 +00:00
#undef BOOST_MEM_FN_NAME
2001-11-10 19:18:58 +00:00
#undef BOOST_MEM_FN_CC
2001-11-20 17:05:56 +00:00
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
2001-11-10 19:18:58 +00:00
2001-11-20 17:05:56 +00:00
#define BOOST_MEM_FN_NAME(X) X##_stdcall
#define BOOST_MEM_FN_CC __stdcall
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#include <boost/bind/mem_fn_cc.hpp>
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#undef BOOST_MEM_FN_NAME
#undef BOOST_MEM_FN_CC
2001-09-04 17:16:30 +00:00
2001-11-20 17:05:56 +00:00
#endif
2001-11-10 19:18:58 +00:00
2001-09-04 17:16:30 +00:00
} // namespace boost
#endif // #ifndef BOOST_MEM_FN_HPP_INCLUDED