mirror of
https://github.com/boostorg/bind.git
synced 2026-04-13 21:25:59 +02:00
Compare commits
1 Commits
boost-1.31
...
boost-1.25
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff9ff3a78d |
@@ -1,6 +1,4 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#if defined(_MSC_VER) && !defined(__ICL)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
|
||||
269
bind_test.cpp
Normal file
269
bind_test.cpp
Normal file
@@ -0,0 +1,269 @@
|
||||
#if defined(_MSC_VER) && !defined(__ICL)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4514) // unreferenced inline removed
|
||||
#endif
|
||||
|
||||
//
|
||||
// bind_test.cpp - monolithic test for bind.hpp
|
||||
//
|
||||
// Version 1.00.0002 (2001-09-02)
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
|
||||
//
|
||||
|
||||
long f_0()
|
||||
{
|
||||
return 17041L;
|
||||
}
|
||||
|
||||
long f_1(long a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
long f_2(long a, long b)
|
||||
{
|
||||
return a + 10 * b;
|
||||
}
|
||||
|
||||
long f_3(long a, long b, long c)
|
||||
{
|
||||
return a + 10 * b + 100 * c;
|
||||
}
|
||||
|
||||
long f_4(long a, long b, long c, long d)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d;
|
||||
}
|
||||
|
||||
long f_5(long a, long b, long c, long d, long e)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e;
|
||||
}
|
||||
|
||||
long f_6(long a, long b, long c, long d, long e, long f)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
|
||||
}
|
||||
|
||||
long f_7(long a, long b, long c, long d, long e, long f, long g)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
|
||||
}
|
||||
|
||||
long f_8(long a, long b, long c, long d, long e, long f, long g, long h)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
|
||||
}
|
||||
|
||||
long f_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
|
||||
}
|
||||
|
||||
void function_test()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
int const i = 1;
|
||||
|
||||
BOOST_TEST( bind(f_0)(i) == 17041L );
|
||||
BOOST_TEST( bind(f_1, _1)(i) == 1L );
|
||||
BOOST_TEST( bind(f_2, _1, 2)(i) == 21L );
|
||||
BOOST_TEST( bind(f_3, _1, 2, 3)(i) == 321L );
|
||||
BOOST_TEST( bind(f_4, _1, 2, 3, 4)(i) == 4321L );
|
||||
BOOST_TEST( bind(f_5, _1, 2, 3, 4, 5)(i) == 54321L );
|
||||
BOOST_TEST( bind(f_6, _1, 2, 3, 4, 5, 6)(i) == 654321L );
|
||||
BOOST_TEST( bind(f_7, _1, 2, 3, 4, 5, 6, 7)(i) == 7654321L );
|
||||
BOOST_TEST( bind(f_8, _1, 2, 3, 4, 5, 6, 7, 8)(i) == 87654321L );
|
||||
BOOST_TEST( bind(f_9, _1, 2, 3, 4, 5, 6, 7, 8, 9)(i) == 987654321L );
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
struct Y
|
||||
{
|
||||
short operator()(short & r) const { return ++r; }
|
||||
int operator()(int a, int b) const { return a + 10 * b; }
|
||||
long operator() (long a, long b, long c) const { return a + 10 * b + 100 * c; }
|
||||
};
|
||||
|
||||
void function_object_test()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
short i(6);
|
||||
|
||||
int const k = 3;
|
||||
|
||||
BOOST_TEST( bind<short>(Y(), ref(i))() == 7 );
|
||||
BOOST_TEST( bind<short>(Y(), ref(i))() == 8 );
|
||||
BOOST_TEST( bind<int>(Y(), i, _1)(k) == 38 );
|
||||
BOOST_TEST( bind<long>(Y(), i, _1, 9)(k) == 938 );
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
struct X
|
||||
{
|
||||
mutable unsigned int hash;
|
||||
|
||||
X(): hash(0) {}
|
||||
|
||||
int f0() { f1(17); return 0; }
|
||||
int g0() const { g1(17); return 0; }
|
||||
|
||||
int f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
|
||||
int g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
|
||||
|
||||
int f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
|
||||
int g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
|
||||
|
||||
int f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
|
||||
int g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
|
||||
|
||||
int f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
|
||||
int g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
|
||||
|
||||
int f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
|
||||
int g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
|
||||
|
||||
int f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
|
||||
int g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
|
||||
|
||||
int f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
|
||||
int g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
|
||||
|
||||
int f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
|
||||
int g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
|
||||
};
|
||||
|
||||
void member_function_test()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
X x;
|
||||
|
||||
// 0
|
||||
|
||||
bind(&X::f0, &x)();
|
||||
bind(&X::f0, ref(x))();
|
||||
|
||||
bind(&X::g0, &x)();
|
||||
bind(&X::g0, x)();
|
||||
bind(&X::g0, ref(x))();
|
||||
|
||||
// 1
|
||||
|
||||
bind(&X::f1, &x, 1)();
|
||||
bind(&X::f1, ref(x), 1)();
|
||||
|
||||
bind(&X::g1, &x, 1)();
|
||||
bind(&X::g1, x, 1)();
|
||||
bind(&X::g1, ref(x), 1)();
|
||||
|
||||
// 2
|
||||
|
||||
bind(&X::f2, &x, 1, 2)();
|
||||
bind(&X::f2, ref(x), 1, 2)();
|
||||
|
||||
bind(&X::g2, &x, 1, 2)();
|
||||
bind(&X::g2, x, 1, 2)();
|
||||
bind(&X::g2, ref(x), 1, 2)();
|
||||
|
||||
// 3
|
||||
|
||||
bind(&X::f3, &x, 1, 2, 3)();
|
||||
bind(&X::f3, ref(x), 1, 2, 3)();
|
||||
|
||||
bind(&X::g3, &x, 1, 2, 3)();
|
||||
bind(&X::g3, x, 1, 2, 3)();
|
||||
bind(&X::g3, ref(x), 1, 2, 3)();
|
||||
|
||||
// 4
|
||||
|
||||
bind(&X::f4, &x, 1, 2, 3, 4)();
|
||||
bind(&X::f4, ref(x), 1, 2, 3, 4)();
|
||||
|
||||
bind(&X::g4, &x, 1, 2, 3, 4)();
|
||||
bind(&X::g4, x, 1, 2, 3, 4)();
|
||||
bind(&X::g4, ref(x), 1, 2, 3, 4)();
|
||||
|
||||
// 5
|
||||
|
||||
bind(&X::f5, &x, 1, 2, 3, 4, 5)();
|
||||
bind(&X::f5, ref(x), 1, 2, 3, 4, 5)();
|
||||
|
||||
bind(&X::g5, &x, 1, 2, 3, 4, 5)();
|
||||
bind(&X::g5, x, 1, 2, 3, 4, 5)();
|
||||
bind(&X::g5, ref(x), 1, 2, 3, 4, 5)();
|
||||
|
||||
// 6
|
||||
|
||||
bind(&X::f6, &x, 1, 2, 3, 4, 5, 6)();
|
||||
bind(&X::f6, ref(x), 1, 2, 3, 4, 5, 6)();
|
||||
|
||||
bind(&X::g6, &x, 1, 2, 3, 4, 5, 6)();
|
||||
bind(&X::g6, x, 1, 2, 3, 4, 5, 6)();
|
||||
bind(&X::g6, ref(x), 1, 2, 3, 4, 5, 6)();
|
||||
|
||||
// 7
|
||||
|
||||
bind(&X::f7, &x, 1, 2, 3, 4, 5, 6, 7)();
|
||||
bind(&X::f7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
|
||||
|
||||
bind(&X::g7, &x, 1, 2, 3, 4, 5, 6, 7)();
|
||||
bind(&X::g7, x, 1, 2, 3, 4, 5, 6, 7)();
|
||||
bind(&X::g7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
|
||||
|
||||
// 8
|
||||
|
||||
bind(&X::f8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
bind(&X::f8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
|
||||
bind(&X::g8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
bind(&X::g8, x, 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
bind(&X::g8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
|
||||
BOOST_TEST( x.hash == 23558 );
|
||||
}
|
||||
|
||||
void nested_bind_test()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
int const x = 1;
|
||||
int const y = 2;
|
||||
|
||||
BOOST_TEST( bind(f_1, bind(f_1, _1))(x) == 1L );
|
||||
BOOST_TEST( bind(f_1, bind(f_2, _1, _2))(x, y) == 21L );
|
||||
BOOST_TEST( bind(f_2, bind(f_1, _1), bind(f_1, _1))(x) == 11L );
|
||||
BOOST_TEST( bind(f_2, bind(f_1, _1), bind(f_1, _2))(x, y) == 21L );
|
||||
BOOST_TEST( bind(f_1, bind(f_0))() == 17041L );
|
||||
}
|
||||
|
||||
int test_main(int, char * [])
|
||||
{
|
||||
function_test();
|
||||
function_object_test();
|
||||
member_function_test();
|
||||
nested_bind_test();
|
||||
|
||||
return 0;
|
||||
}
|
||||
104
bind_test_1.cpp
Normal file
104
bind_test_1.cpp
Normal file
@@ -0,0 +1,104 @@
|
||||
#if defined(_MSC_VER) && !defined(__ICL)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4514) // unreferenced inline removed
|
||||
#endif
|
||||
|
||||
//
|
||||
// bind_test_1.cpp - tests bind.hpp with function pointers
|
||||
//
|
||||
// Version 1.00.0003 (2001-07-13)
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <iostream>
|
||||
|
||||
long f_1(long a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
long f_2(long a, long b)
|
||||
{
|
||||
return a + 10 * b;
|
||||
}
|
||||
|
||||
long f_3(long a, long b, long c)
|
||||
{
|
||||
return a + 10 * b + 100 * c;
|
||||
}
|
||||
|
||||
long f_4(long a, long b, long c, long d)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d;
|
||||
}
|
||||
|
||||
long f_5(long a, long b, long c, long d, long e)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e;
|
||||
}
|
||||
|
||||
long f_6(long a, long b, long c, long d, long e, long f)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
|
||||
}
|
||||
|
||||
long f_7(long a, long b, long c, long d, long e, long f, long g)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
|
||||
}
|
||||
|
||||
long f_8(long a, long b, long c, long d, long e, long f, long g, long h)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
|
||||
}
|
||||
|
||||
long f_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
|
||||
}
|
||||
|
||||
unsigned long hash = 0;
|
||||
|
||||
template<class F> void test(F f)
|
||||
{
|
||||
int const i = 1;
|
||||
hash = (hash * 17041 + f(i)) % 32768;
|
||||
}
|
||||
|
||||
int detect_errors(bool x)
|
||||
{
|
||||
if(x)
|
||||
{
|
||||
std::cerr << "no errors detected.\n";
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "test failed.\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test(boost::bind(f_1, _1));
|
||||
test(boost::bind(f_2, _1, 2));
|
||||
test(boost::bind(f_3, _1, 2, 3));
|
||||
test(boost::bind(f_4, _1, 2, 3, 4));
|
||||
test(boost::bind(f_5, _1, 2, 3, 4, 5));
|
||||
test(boost::bind(f_6, _1, 2, 3, 4, 5, 6));
|
||||
test(boost::bind(f_7, _1, 2, 3, 4, 5, 6, 7));
|
||||
test(boost::bind(f_8, _1, 2, 3, 4, 5, 6, 7, 8));
|
||||
test(boost::bind(f_9, _1, 2, 3, 4, 5, 6, 7, 8, 9));
|
||||
|
||||
return detect_errors(hash == 18797);
|
||||
}
|
||||
65
bind_test_2.cpp
Normal file
65
bind_test_2.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#if defined(_MSC_VER) && !defined(__ICL)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4514) // unreferenced inline removed
|
||||
#endif
|
||||
|
||||
//
|
||||
// bind_test_2.cpp - tests bind.hpp with function objects
|
||||
//
|
||||
// Version 1.00.0005 (2001-07-13)
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <iostream>
|
||||
|
||||
struct X
|
||||
{
|
||||
short operator()(short & r) const { return ++r; }
|
||||
int operator()(int a, int b) const { return a + 10 * b; }
|
||||
long operator() (long a, long b, long c) const { return a + 10 * b + 100 * c; }
|
||||
};
|
||||
|
||||
unsigned long hash = 0;
|
||||
|
||||
template<class F> void test(F f, int const i)
|
||||
{
|
||||
hash = (hash * 17041 + f(i)) % 32768;
|
||||
}
|
||||
|
||||
int detect_errors(bool x)
|
||||
{
|
||||
if(x)
|
||||
{
|
||||
std::cerr << "no errors detected.\n";
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "test failed.\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
short i(6);
|
||||
|
||||
test(bind<short>(X(), ref(i)), 1);
|
||||
test(bind<short>(X(), ref(i)), 2);
|
||||
test(bind<int>(X(), i, _1), 3);
|
||||
test(bind<long>(X(), i, _1, 9), 4);
|
||||
|
||||
return detect_errors(hash == 24857);
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#if defined(_MSC_VER) && !defined(__ICL)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
@@ -8,7 +6,9 @@
|
||||
#endif
|
||||
|
||||
//
|
||||
// bind_stdcall_mf_test.cpp - test for bind.hpp + __stdcall (member functions)
|
||||
// bind_test_3.cpp - tests bind.hpp with member function pointers
|
||||
//
|
||||
// Version 1.00.0003 (2001-07-13)
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
@@ -18,57 +18,59 @@
|
||||
// warranty, and with no claim as to its suitability for any purpose.
|
||||
//
|
||||
|
||||
#define BOOST_MEM_FN_ENABLE_FASTCALL
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
struct X
|
||||
{
|
||||
mutable unsigned int hash;
|
||||
|
||||
X(): hash(0) {}
|
||||
|
||||
void __fastcall f0() { f1(17); }
|
||||
void __fastcall g0() const { g1(17); }
|
||||
int f0() { f1(17); return 0; }
|
||||
int g0() const { g1(17); return 0; }
|
||||
|
||||
void __fastcall f1(int a1) { hash = (hash * 17041 + a1) % 32768; }
|
||||
void __fastcall g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; }
|
||||
int f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
|
||||
int g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
|
||||
|
||||
void __fastcall f2(int a1, int a2) { f1(a1); f1(a2); }
|
||||
void __fastcall g2(int a1, int a2) const { g1(a1); g1(a2); }
|
||||
int f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
|
||||
int g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
|
||||
|
||||
void __fastcall f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); }
|
||||
void __fastcall g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); }
|
||||
int f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
|
||||
int g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
|
||||
|
||||
void __fastcall f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); }
|
||||
void __fastcall g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); }
|
||||
int f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
|
||||
int g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
|
||||
|
||||
void __fastcall f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); }
|
||||
void __fastcall g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); }
|
||||
int f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
|
||||
int g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
|
||||
|
||||
void __fastcall f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); }
|
||||
void __fastcall g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); }
|
||||
int f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
|
||||
int g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
|
||||
|
||||
void __fastcall f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); }
|
||||
void __fastcall g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); }
|
||||
int f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
|
||||
int g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
|
||||
|
||||
void __fastcall f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); }
|
||||
void __fastcall g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); }
|
||||
int f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
|
||||
int g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
|
||||
};
|
||||
|
||||
void member_function_test()
|
||||
int detect_errors(bool x)
|
||||
{
|
||||
if(x)
|
||||
{
|
||||
std::cerr << "no errors detected.\n";
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "test failed.\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
@@ -155,11 +157,5 @@ void member_function_test()
|
||||
bind(&X::g8, x, 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
bind(&X::g8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
|
||||
BOOST_TEST( x.hash == 23558 );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
member_function_test();
|
||||
return boost::report_errors();
|
||||
return detect_errors(x.hash == 23558);
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#if defined(_MSC_VER) && !defined(__ICL)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
@@ -8,7 +6,9 @@
|
||||
#endif
|
||||
|
||||
//
|
||||
// bind_visitor.cpp - tests bind.hpp with a visitor
|
||||
// bind_test_4.cpp - tests bind.hpp with a visitor
|
||||
//
|
||||
// Version 1.00.0003 (2001-08-30)
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
@@ -20,48 +20,42 @@
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <typeinfo>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// default implementation of visit_each
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<class V, class T> void visit_each(V & v, T const & t, long)
|
||||
{
|
||||
v(t, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// visitor
|
||||
|
||||
int hash = 0;
|
||||
|
||||
struct visitor
|
||||
struct ref_visitor
|
||||
{
|
||||
template<class T> void operator()(boost::reference_wrapper<T> const & r, int) const
|
||||
template<class R, class F, class L> void operator()(boost::_bi::bind_t<R, F, L> const & b) const
|
||||
{
|
||||
b.accept(*this);
|
||||
}
|
||||
|
||||
template<class T> void operator()(boost::reference_wrapper<T> const & r) const
|
||||
{
|
||||
std::cout << "Reference to " << typeid(T).name() << " @ " << &r.get() << " (with value " << r.get() << ")\n";
|
||||
hash += r.get();
|
||||
}
|
||||
|
||||
template<class T> void operator()(T const &, long) const
|
||||
#ifndef BOOST_MSVC
|
||||
|
||||
template<class T> void operator()(T const &) const
|
||||
{
|
||||
std::cout << "Value of type " << typeid(T).name() << '\n';
|
||||
++hash;
|
||||
std::cout << "Catch-all: " << typeid(T).name() << '\n';
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void operator()(...) const
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
int f(int & i, int & j, int)
|
||||
int f(int & i, int & j)
|
||||
{
|
||||
++i;
|
||||
--j;
|
||||
@@ -89,8 +83,7 @@ int main()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
visitor v;
|
||||
visit_each(v, bind<int>(bind(f, ref(x), _1, 42), ref(y)), 0);
|
||||
ref_visitor()(bind<int>(bind(f, ref(x), _1), ref(y)));
|
||||
|
||||
return detect_errors(hash == 12);
|
||||
return detect_errors(hash == 9);
|
||||
}
|
||||
242
doc/ref.xml
242
doc/ref.xml
@@ -1,242 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
||||
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
||||
<library name="Ref" dirname="ref" id="ref" last-revision="$Date$">
|
||||
<libraryinfo>
|
||||
<author>
|
||||
<firstname>Jaakko</firstname>
|
||||
<surname>Järvi</surname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Peter</firstname>
|
||||
<surname>Dimov</surname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Douglas</firstname>
|
||||
<surname>Gregor</surname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Dave</firstname>
|
||||
<surname>Abrahams</surname>
|
||||
</author>
|
||||
|
||||
<copyright>
|
||||
<year>1999</year>
|
||||
<year>2000</year>
|
||||
<holder>Jaakko Järvi</holder>
|
||||
</copyright>
|
||||
|
||||
<copyright>
|
||||
<year>2001</year>
|
||||
<year>2002</year>
|
||||
<holder>Peter Dimov</holder>
|
||||
</copyright>
|
||||
|
||||
<copyright>
|
||||
<year>2002</year>
|
||||
<holder>David Abrahams</holder>
|
||||
</copyright>
|
||||
|
||||
<legalnotice>
|
||||
<para>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.
|
||||
</para>
|
||||
</legalnotice>
|
||||
|
||||
<librarypurpose>A utility library for passing references to generic functions</librarypurpose>
|
||||
<librarycategory name="category:higher-order"/>
|
||||
</libraryinfo>
|
||||
|
||||
<title>Boost.Ref</title>
|
||||
|
||||
<section id="ref.intro">
|
||||
<title>Introduction</title>
|
||||
|
||||
<using-namespace name="boost"/>
|
||||
|
||||
<para>The Ref library is a small library that is useful for passing
|
||||
references to function templates (algorithms) that would usually
|
||||
take copies of their arguments. It defines the class template
|
||||
<code><classname>boost::reference_wrapper<T></classname></code>,
|
||||
the two functions
|
||||
<code><functionname>boost::ref</functionname></code> and
|
||||
<code><functionname>boost::cref</functionname></code> that return
|
||||
instances of <code>boost::reference_wrapper<T></code>, and the
|
||||
two traits classes
|
||||
<code><classname>boost::is_reference_wrapper<T></classname></code>
|
||||
and
|
||||
<code><classname>boost::unwrap_reference<T></classname></code>.</para>
|
||||
|
||||
<para>The purpose of
|
||||
<code>boost::reference_wrapper<T></code> is to
|
||||
contain a reference to an object of type T. It is primarily used to
|
||||
"feed" references to function templates (algorithms) that take their
|
||||
parameter by value.</para>
|
||||
|
||||
<para>To support this usage,
|
||||
<code>boost::reference_wrapper<T></code> provides an implicit
|
||||
conversion to <code>T&</code>. This usually allows the function
|
||||
templates to work on references unmodified.</para>
|
||||
|
||||
<para><code>boost::reference_wrapper<T></code> is
|
||||
both CopyConstructible and Assignable (ordinary references are not
|
||||
Assignable).</para>
|
||||
|
||||
<para>The expression <code>boost::ref(x)</code>
|
||||
returns a
|
||||
<code>boost::reference_wrapper<X>(x)</code> where X
|
||||
is the type of x. Similarly,
|
||||
<code>boost::cref(x)</code> returns a
|
||||
<code>boost::reference_wrapper<X const>(x)</code>.</para>
|
||||
|
||||
<para>The expression
|
||||
<code>boost::is_reference_wrapper<T>::value</code>
|
||||
is true if T is a <code>reference_wrapper</code>, and
|
||||
false otherwise.</para>
|
||||
|
||||
<para>The type-expression
|
||||
<code>boost::unwrap_reference<T>::type</code> is T::type if T
|
||||
is a <code>reference_wrapper</code>, T otherwise.</para>
|
||||
</section>
|
||||
|
||||
<library-reference>
|
||||
<header name="boost/ref.hpp">
|
||||
<namespace name="boost">
|
||||
<class name="reference_wrapper">
|
||||
<template>
|
||||
<template-type-parameter name="T"/>
|
||||
</template>
|
||||
<purpose>
|
||||
Contains a reference to an object of type
|
||||
<computeroutput>T</computeroutput>.
|
||||
</purpose>
|
||||
|
||||
<description>
|
||||
<para><computeroutput><classname>reference_wrapper</classname></computeroutput>
|
||||
is primarily used to "feed" references to function templates
|
||||
(algorithms) that take their parameter by value. It provides
|
||||
an implicit conversion to
|
||||
<computeroutput>T&</computeroutput>, which usually allows
|
||||
the function templates to work on references
|
||||
unmodified.</para>
|
||||
</description>
|
||||
|
||||
<typedef name="type"><type>T</type></typedef>
|
||||
|
||||
<constructor specifiers="explicit">
|
||||
<parameter name="t">
|
||||
<paramtype>T&</paramtype>
|
||||
</parameter>
|
||||
|
||||
<effects><simpara>Constructs a
|
||||
<computeroutput><classname>reference_wrapper</classname></computeroutput>
|
||||
object that stores a reference to
|
||||
<computeroutput>t</computeroutput>.</simpara></effects>
|
||||
|
||||
<throws><simpara>Does not throw.</simpara></throws>
|
||||
</constructor>
|
||||
|
||||
<method-group name="access">
|
||||
<method name="conversion-operator" cv="const">
|
||||
<type>T&</type>
|
||||
<returns><simpara>The stored reference.</simpara></returns>
|
||||
<throws><simpara>Does not throw.</simpara></throws>
|
||||
</method>
|
||||
|
||||
<method name="get" cv="const">
|
||||
<type>T&</type>
|
||||
<returns><simpara>The stored reference.</simpara></returns>
|
||||
<throws><simpara>Does not throw.</simpara></throws>
|
||||
</method>
|
||||
|
||||
<method name="get_pointer" cv="const">
|
||||
<type>T*</type>
|
||||
<returns><simpara>A pointer to the object referenced by the stored reference.</simpara></returns>
|
||||
<throws><simpara>Does not throw.</simpara></throws>
|
||||
</method>
|
||||
</method-group>
|
||||
|
||||
<free-function-group name="constructors">
|
||||
<function name="ref">
|
||||
<type>reference_wrapper<T></type>
|
||||
<parameter name="t">
|
||||
<paramtype>T&</paramtype>
|
||||
</parameter>
|
||||
|
||||
<returns><simpara><computeroutput><classname>reference_wrapper</classname><T>(t)</computeroutput></simpara></returns>
|
||||
|
||||
<throws><simpara>Does not throw.</simpara></throws>
|
||||
</function>
|
||||
|
||||
<function name="cref">
|
||||
<type>reference_wrapper<T const></type>
|
||||
<parameter name="t">
|
||||
<paramtype>T const&</paramtype>
|
||||
</parameter>
|
||||
|
||||
<returns><simpara><computeroutput><classname>reference_wrapper</classname><T const>(t)</computeroutput></simpara></returns>
|
||||
|
||||
<throws><simpara>Does not throw.</simpara></throws>
|
||||
</function>
|
||||
</free-function-group>
|
||||
</class>
|
||||
|
||||
<class name="is_reference_wrapper">
|
||||
<template>
|
||||
<template-type-parameter name="T"/>
|
||||
</template>
|
||||
|
||||
<purpose>Determine if a type <computeroutput>T</computeroutput> is an instantiation of <computeroutput><classname>reference_wrapper</classname></computeroutput>.</purpose>
|
||||
|
||||
<description>
|
||||
<para>The <computeroutput>value</computeroutput> static
|
||||
constant will be <computeroutput>true</computeroutput> iff the
|
||||
type <computeroutput>T</computeroutput> is a specialization of
|
||||
<computeroutput><classname>reference_wrapper</classname></computeroutput>.</para>
|
||||
</description>
|
||||
|
||||
<static-constant name="value">
|
||||
<type>bool</type>
|
||||
<default><emphasis>unspecified</emphasis></default>
|
||||
</static-constant>
|
||||
</class>
|
||||
|
||||
<class name="unwrap_reference">
|
||||
<template>
|
||||
<template-type-parameter name="T"/>
|
||||
</template>
|
||||
|
||||
<purpose>Find the type in a <computeroutput><classname>reference_wrapper</classname></computeroutput>.</purpose>
|
||||
|
||||
<description>
|
||||
<para>The typedef <computeroutput>type</computeroutput> is
|
||||
<computeroutput>T::type</computeroutput> if
|
||||
<computeroutput>T</computeroutput> is a
|
||||
<computeroutput><classname>reference_wrapper</classname></computeroutput>,
|
||||
<computeroutput>T</computeroutput> otherwise.</para>
|
||||
</description>
|
||||
|
||||
<typedef name="T"><type><emphasis>unspecified</emphasis></type></typedef>
|
||||
</class>
|
||||
</namespace>
|
||||
</header>
|
||||
</library-reference>
|
||||
|
||||
<section id="ref.ack">
|
||||
<title>Acknowledgements</title>
|
||||
|
||||
<using-namespace name="boost"/>
|
||||
|
||||
<para><functionname>ref</functionname> and <functionname>cref</functionname>
|
||||
were originally part of the <libraryname>Tuple</libraryname> library
|
||||
by Jaakko Järvi. They were "promoted to boost:: status" by
|
||||
Peter Dimov because they are generally useful. Douglas Gregor and
|
||||
Dave Abrahams contributed
|
||||
<classname>is_reference_wrapper</classname> and
|
||||
<classname>unwrap_reference</classname>.</para>
|
||||
</section>
|
||||
|
||||
</library>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,75 +0,0 @@
|
||||
#ifndef BOOST_BIND_APPLY_HPP_INCLUDED
|
||||
#define BOOST_BIND_APPLY_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// apply.hpp
|
||||
//
|
||||
// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<class R> struct apply
|
||||
{
|
||||
typedef R result_type;
|
||||
|
||||
template<class F> result_type operator()(F & f) const
|
||||
{
|
||||
return f();
|
||||
}
|
||||
|
||||
template<class F, class A1> result_type operator()(F & f, A1 & a1) const
|
||||
{
|
||||
return f(a1);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2> result_type operator()(F & f, A1 & a1, A2 & a2) const
|
||||
{
|
||||
return f(a1, a2);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3) const
|
||||
{
|
||||
return f(a1, a2, a3);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3, class A4> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4) const
|
||||
{
|
||||
return f(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3, class A4, class A5> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const
|
||||
{
|
||||
return f(a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const
|
||||
{
|
||||
return f(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const
|
||||
{
|
||||
return f(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const
|
||||
{
|
||||
return f(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const
|
||||
{
|
||||
return f(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_BIND_APPLY_HPP_INCLUDED
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef BOOST_BIND_ARG_HPP_INCLUDED
|
||||
#define BOOST_BIND_ARG_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// bind/arg.hpp
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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/bind.html for documentation.
|
||||
//
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<int I> class arg
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_BIND_ARG_HPP_INCLUDED
|
||||
@@ -1,118 +0,0 @@
|
||||
//
|
||||
// bind/bind_cc.hpp - support for different calling conventions
|
||||
//
|
||||
// Do not include this header directly.
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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/bind.html for documentation.
|
||||
//
|
||||
|
||||
template<class R>
|
||||
_bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (), _bi::list0>
|
||||
BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) ())
|
||||
{
|
||||
typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) ();
|
||||
typedef _bi::list0 list_type;
|
||||
return _bi::bind_t<R, F, list_type> (f, list_type());
|
||||
}
|
||||
|
||||
template<class R, class B1, class A1>
|
||||
_bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1), typename _bi::list_av_1<A1>::type>
|
||||
BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1), A1 a1)
|
||||
{
|
||||
typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1);
|
||||
typedef typename _bi::list_av_1<A1>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type> (f, list_type(a1));
|
||||
}
|
||||
|
||||
template<class R, class B1, class B2, class A1, class A2>
|
||||
_bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2), typename _bi::list_av_2<A1, A2>::type>
|
||||
BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2), A1 a1, A2 a2)
|
||||
{
|
||||
typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2);
|
||||
typedef typename _bi::list_av_2<A1, A2>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
|
||||
}
|
||||
|
||||
template<class R,
|
||||
class B1, class B2, class B3,
|
||||
class A1, class A2, class A3>
|
||||
_bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3), typename _bi::list_av_3<A1, A2, A3>::type>
|
||||
BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3), A1 a1, A2 a2, A3 a3)
|
||||
{
|
||||
typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3);
|
||||
typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
|
||||
}
|
||||
|
||||
template<class R,
|
||||
class B1, class B2, class B3, class B4,
|
||||
class A1, class A2, class A3, class A4>
|
||||
_bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4), typename _bi::list_av_4<A1, A2, A3, A4>::type>
|
||||
BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4), A1 a1, A2 a2, A3 a3, A4 a4)
|
||||
{
|
||||
typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4);
|
||||
typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
|
||||
}
|
||||
|
||||
template<class R,
|
||||
class B1, class B2, class B3, class B4, class B5,
|
||||
class A1, class A2, class A3, class A4, class A5>
|
||||
_bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5), typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
|
||||
BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
|
||||
{
|
||||
typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5);
|
||||
typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
|
||||
}
|
||||
|
||||
template<class R,
|
||||
class B1, class B2, class B3, class B4, class B5, class B6,
|
||||
class A1, class A2, class A3, class A4, class A5, class A6>
|
||||
_bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5, B6), typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
|
||||
BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
|
||||
{
|
||||
typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6);
|
||||
typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
|
||||
}
|
||||
|
||||
template<class R,
|
||||
class B1, class B2, class B3, class B4, class B5, class B6, class B7,
|
||||
class A1, class A2, class A3, class A4, class A5, class A6, class A7>
|
||||
_bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5, B6, B7), typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
|
||||
BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
|
||||
{
|
||||
typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7);
|
||||
typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
|
||||
}
|
||||
|
||||
template<class R,
|
||||
class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8,
|
||||
class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
|
||||
_bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5, B6, B7, B8), typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
|
||||
BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7, B8), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
|
||||
{
|
||||
typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7, B8);
|
||||
typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
|
||||
}
|
||||
|
||||
template<class R,
|
||||
class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8, class B9,
|
||||
class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
|
||||
_bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5, B6, B7, B8, B9), typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
|
||||
BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7, B8, B9), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
|
||||
{
|
||||
typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7, B8, B9);
|
||||
typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
|
||||
}
|
||||
@@ -1,228 +0,0 @@
|
||||
//
|
||||
// bind/bind_mf_cc.hpp - support for different calling conventions
|
||||
//
|
||||
// Do not include this header directly.
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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/bind.html for documentation.
|
||||
//
|
||||
|
||||
// 0
|
||||
|
||||
template<class R, class T,
|
||||
class A1>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf0)<R, T>, typename _bi::list_av_1<A1>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (), A1 a1)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(mf0)<R, T> F;
|
||||
typedef typename _bi::list_av_1<A1>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1));
|
||||
}
|
||||
|
||||
template<class R, class T,
|
||||
class A1>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf0)<R, T>, typename _bi::list_av_1<A1>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () const, A1 a1)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(cmf0)<R, T> F;
|
||||
typedef typename _bi::list_av_1<A1>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1));
|
||||
}
|
||||
|
||||
// 1
|
||||
|
||||
template<class R, class T,
|
||||
class B1,
|
||||
class A1, class A2>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf1)<R, T, B1>, typename _bi::list_av_2<A1, A2>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1), A1 a1, A2 a2)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(mf1)<R, T, B1> F;
|
||||
typedef typename _bi::list_av_2<A1, A2>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2));
|
||||
}
|
||||
|
||||
template<class R, class T,
|
||||
class B1,
|
||||
class A1, class A2>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf1)<R, T, B1>, typename _bi::list_av_2<A1, A2>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const, A1 a1, A2 a2)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(cmf1)<R, T, B1> F;
|
||||
typedef typename _bi::list_av_2<A1, A2>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2));
|
||||
}
|
||||
|
||||
// 2
|
||||
|
||||
template<class R, class T,
|
||||
class B1, class B2,
|
||||
class A1, class A2, class A3>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf2)<R, T, B1, B2>, typename _bi::list_av_3<A1, A2, A3>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2), A1 a1, A2 a2, A3 a3)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(mf2)<R, T, B1, B2> F;
|
||||
typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3));
|
||||
}
|
||||
|
||||
template<class R, class T,
|
||||
class B1, class B2,
|
||||
class A1, class A2, class A3>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf2)<R, T, B1, B2>, typename _bi::list_av_3<A1, A2, A3>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) const, A1 a1, A2 a2, A3 a3)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(cmf2)<R, T, B1, B2> F;
|
||||
typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3));
|
||||
}
|
||||
|
||||
// 3
|
||||
|
||||
template<class R, class T,
|
||||
class B1, class B2, class B3,
|
||||
class A1, class A2, class A3, class A4>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf3)<R, T, B1, B2, B3>, typename _bi::list_av_4<A1, A2, A3, A4>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3), A1 a1, A2 a2, A3 a3, A4 a4)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(mf3)<R, T, B1, B2, B3> F;
|
||||
typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4));
|
||||
}
|
||||
|
||||
template<class R, class T,
|
||||
class B1, class B2, class B3,
|
||||
class A1, class A2, class A3, class A4>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf3)<R, T, B1, B2, B3>, typename _bi::list_av_4<A1, A2, A3, A4>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const, A1 a1, A2 a2, A3 a3, A4 a4)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(cmf3)<R, T, B1, B2, B3> F;
|
||||
typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4));
|
||||
}
|
||||
|
||||
// 4
|
||||
|
||||
template<class R, class T,
|
||||
class B1, class B2, class B3, class B4,
|
||||
class A1, class A2, class A3, class A4, class A5>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf4)<R, T, B1, B2, B3, B4>, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(mf4)<R, T, B1, B2, B3, B4> F;
|
||||
typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5));
|
||||
}
|
||||
|
||||
template<class R, class T,
|
||||
class B1, class B2, class B3, class B4,
|
||||
class A1, class A2, class A3, class A4, class A5>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf4)<R, T, B1, B2, B3, B4>, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(cmf4)<R, T, B1, B2, B3, B4> F;
|
||||
typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5));
|
||||
}
|
||||
|
||||
// 5
|
||||
|
||||
template<class R, class T,
|
||||
class B1, class B2, class B3, class B4, class B5,
|
||||
class A1, class A2, class A3, class A4, class A5, class A6>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf5)<R, T, B1, B2, B3, B4, B5>, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(mf5)<R, T, B1, B2, B3, B4, B5> F;
|
||||
typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6));
|
||||
}
|
||||
|
||||
template<class R, class T,
|
||||
class B1, class B2, class B3, class B4, class B5,
|
||||
class A1, class A2, class A3, class A4, class A5, class A6>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf5)<R, T, B1, B2, B3, B4, B5>, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(cmf5)<R, T, B1, B2, B3, B4, B5> F;
|
||||
typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6));
|
||||
}
|
||||
|
||||
// 6
|
||||
|
||||
template<class R, class T,
|
||||
class B1, class B2, class B3, class B4, class B5, class B6,
|
||||
class A1, class A2, class A3, class A4, class A5, class A6, class A7>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf6)<R, T, B1, B2, B3, B4, B5, B6>, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(mf6)<R, T, B1, B2, B3, B4, B5, B6> F;
|
||||
typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7));
|
||||
}
|
||||
|
||||
template<class R, class T,
|
||||
class B1, class B2, class B3, class B4, class B5, class B6,
|
||||
class A1, class A2, class A3, class A4, class A5, class A6, class A7>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf6)<R, T, B1, B2, B3, B4, B5, B6>, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(cmf6)<R, T, B1, B2, B3, B4, B5, B6> F;
|
||||
typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7));
|
||||
}
|
||||
|
||||
// 7
|
||||
|
||||
template<class R, class T,
|
||||
class B1, class B2, class B3, class B4, class B5, class B6, class B7,
|
||||
class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf7)<R, T, B1, B2, B3, B4, B5, B6, B7>, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(mf7)<R, T, B1, B2, B3, B4, B5, B6, B7> F;
|
||||
typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8));
|
||||
}
|
||||
|
||||
template<class R, class T,
|
||||
class B1, class B2, class B3, class B4, class B5, class B6, class B7,
|
||||
class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf7)<R, T, B1, B2, B3, B4, B5, B6, B7>, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(cmf7)<R, T, B1, B2, B3, B4, B5, B6, B7> F;
|
||||
typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8));
|
||||
}
|
||||
|
||||
// 8
|
||||
|
||||
template<class R, class T,
|
||||
class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8,
|
||||
class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8>, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(mf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8> F;
|
||||
typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
|
||||
}
|
||||
|
||||
template<class R, class T,
|
||||
class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8,
|
||||
class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
|
||||
_bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8>, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
|
||||
BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
|
||||
{
|
||||
typedef _mfi::BOOST_BIND_MF_NAME(cmf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8> F;
|
||||
typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
|
||||
return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
//
|
||||
// bind/bind_template.hpp
|
||||
//
|
||||
// Do not include this header directly.
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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/bind.html for documentation.
|
||||
//
|
||||
|
||||
typedef typename result_traits<R, F>::type result_type;
|
||||
|
||||
result_type operator()()
|
||||
{
|
||||
list0 a;
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
result_type operator()() const
|
||||
{
|
||||
list0 a;
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1> result_type operator()(A1 & a1)
|
||||
{
|
||||
list1<A1 &> a(a1);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1> result_type operator()(A1 & a1) const
|
||||
{
|
||||
list1<A1 &> a(a1);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2)
|
||||
{
|
||||
list2<A1 &, A2 &> a(a1, a2);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) const
|
||||
{
|
||||
list2<A1 &, A2 &> a(a1, a2);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3)
|
||||
{
|
||||
list3<A1 &, A2 &, A3 &> a(a1, a2, a3);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3) const
|
||||
{
|
||||
list3<A1 &, A2 &, A3 &> a(a1, a2, a3);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4)
|
||||
{
|
||||
list4<A1 &, A2 &, A3 &, A4 &> a(a1, a2, a3, a4);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const
|
||||
{
|
||||
list4<A1 &, A2 &, A3 &, A4 &> a(a1, a2, a3, a4);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5)
|
||||
{
|
||||
list5<A1 &, A2 &, A3 &, A4 &, A5 &> a(a1, a2, a3, a4, a5);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const
|
||||
{
|
||||
list5<A1 &, A2 &, A3 &, A4 &, A5 &> a(a1, a2, a3, a4, a5);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6)
|
||||
{
|
||||
list6<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &> a(a1, a2, a3, a4, a5, a6);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const
|
||||
{
|
||||
list6<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &> a(a1, a2, a3, a4, a5, a6);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7)
|
||||
{
|
||||
list7<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &> a(a1, a2, a3, a4, a5, a6, a7);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const
|
||||
{
|
||||
list7<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &> a(a1, a2, a3, a4, a5, a6, a7);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8)
|
||||
{
|
||||
list8<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &> a(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const
|
||||
{
|
||||
list8<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &> a(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9)
|
||||
{
|
||||
list9<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &, A9 &> a(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const
|
||||
{
|
||||
list9<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &, A9 &> a(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A> result_type eval(A & a)
|
||||
{
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class A> result_type eval(A & a) const
|
||||
{
|
||||
BOOST_BIND_EVALUATE;
|
||||
}
|
||||
|
||||
template<class V> void accept(V & v) const
|
||||
{
|
||||
BOOST_BIND_VISIT_EACH(v, f_, 0);
|
||||
l_.accept(v);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
L l_;
|
||||
@@ -1,172 +0,0 @@
|
||||
#ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
|
||||
#define BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// make_adaptable.hpp
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace _bi
|
||||
{
|
||||
|
||||
template<class F> void instantiate(F)
|
||||
{
|
||||
}
|
||||
|
||||
template<class R, class F> class af0
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
explicit af0(F f): f_(f)
|
||||
{
|
||||
}
|
||||
|
||||
result_type operator()()
|
||||
{
|
||||
return f_();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
};
|
||||
|
||||
template<class R, class A1, class F> class af1
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef A1 argument_type;
|
||||
typedef A1 arg1_type;
|
||||
|
||||
explicit af1(F f): f_(f)
|
||||
{
|
||||
}
|
||||
|
||||
result_type operator()(A1 a1)
|
||||
{
|
||||
return f_(a1);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
};
|
||||
|
||||
template<class R, class A1, class A2, class F> class af2
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef A1 first_argument_type;
|
||||
typedef A2 second_argument_type;
|
||||
typedef A1 arg1_type;
|
||||
typedef A2 arg2_type;
|
||||
|
||||
explicit af2(F f): f_(f)
|
||||
{
|
||||
}
|
||||
|
||||
result_type operator()(A1 a1, A2 a2)
|
||||
{
|
||||
return f_(a1, a2);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
};
|
||||
|
||||
template<class R, class A1, class A2, class A3, class F> class af3
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef A1 arg1_type;
|
||||
typedef A2 arg2_type;
|
||||
typedef A3 arg3_type;
|
||||
|
||||
explicit af3(F f): f_(f)
|
||||
{
|
||||
}
|
||||
|
||||
result_type operator()(A1 a1, A2 a2, A3 a3)
|
||||
{
|
||||
return f_(a1, a2, a3);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
};
|
||||
|
||||
template<class R, class A1, class A2, class A3, class A4, class F> class af4
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef A1 arg1_type;
|
||||
typedef A2 arg2_type;
|
||||
typedef A3 arg3_type;
|
||||
typedef A4 arg4_type;
|
||||
|
||||
explicit af4(F f): f_(f)
|
||||
{
|
||||
}
|
||||
|
||||
result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4)
|
||||
{
|
||||
return f_(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
};
|
||||
|
||||
} // namespace _bi
|
||||
|
||||
template<class R, class F> _bi::af0<R, F> make_adaptable(F f)
|
||||
{
|
||||
_bi::instantiate( &_bi::af0<R, F>::operator() ); // for early error detection
|
||||
return _bi::af0<R, F>(f);
|
||||
}
|
||||
|
||||
template<class R, class A1, class F> _bi::af1<R, A1, F> make_adaptable(F f)
|
||||
{
|
||||
instantiate( &_bi::af1<R, A1, F>::operator() );
|
||||
return _bi::af1<R, A1, F>(f);
|
||||
}
|
||||
|
||||
template<class R, class A1, class A2, class F> _bi::af2<R, A1, A2, F> make_adaptable(F f)
|
||||
{
|
||||
instantiate( &_bi::af2<R, A1, A2, F>::operator() );
|
||||
return _bi::af2<R, A1, A2, F>(f);
|
||||
}
|
||||
|
||||
template<class R, class A1, class A2, class A3, class F> _bi::af3<R, A1, A2, A3, F> make_adaptable(F f)
|
||||
{
|
||||
instantiate( &_bi::af3<R, A1, A2, A3, F>::operator() );
|
||||
return _bi::af3<R, A1, A2, A3, F>(f);
|
||||
}
|
||||
|
||||
template<class R, class A1, class A2, class A3, class A4, class F> _bi::af4<R, A1, A2, A3, A4, F> make_adaptable(F f)
|
||||
{
|
||||
instantiate( &_bi::af4<R, A1, A2, A3, A4, F>::operator() );
|
||||
return _bi::af4<R, A1, A2, A3, A4, F>(f);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
|
||||
@@ -1,104 +0,0 @@
|
||||
//
|
||||
// bind/mem_fn_cc.hpp - support for different calling conventions
|
||||
//
|
||||
// Do not include this header directly.
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
template<class R, class T> _mfi::BOOST_MEM_FN_NAME(mf0)<R, T> mem_fn(R (BOOST_MEM_FN_CC T::*f) ())
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf0)<R, T>(f);
|
||||
}
|
||||
|
||||
template<class R, class T> _mfi::BOOST_MEM_FN_NAME(cmf0)<R, T> mem_fn(R (BOOST_MEM_FN_CC T::*f) () const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf0)<R, T>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1> _mfi::BOOST_MEM_FN_NAME(mf1)<R, T, A1> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf1)<R, T, A1>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1> _mfi::BOOST_MEM_FN_NAME(cmf1)<R, T, A1> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf1)<R, T, A1>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2> _mfi::BOOST_MEM_FN_NAME(mf2)<R, T, A1, A2> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf2)<R, T, A1, A2>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2> _mfi::BOOST_MEM_FN_NAME(cmf2)<R, T, A1, A2> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf2)<R, T, A1, A2>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3> _mfi::BOOST_MEM_FN_NAME(mf3)<R, T, A1, A2, A3> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf3)<R, T, A1, A2, A3>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3> _mfi::BOOST_MEM_FN_NAME(cmf3)<R, T, A1, A2, A3> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf3)<R, T, A1, A2, A3>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4> _mfi::BOOST_MEM_FN_NAME(mf4)<R, T, A1, A2, A3, A4> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf4)<R, T, A1, A2, A3, A4>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4> _mfi::BOOST_MEM_FN_NAME(cmf4)<R, T, A1, A2, A3, A4> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf4)<R, T, A1, A2, A3, A4>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5> _mfi::BOOST_MEM_FN_NAME(mf5)<R, T, A1, A2, A3, A4, A5> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf5)<R, T, A1, A2, A3, A4, A5>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5> _mfi::BOOST_MEM_FN_NAME(cmf5)<R, T, A1, A2, A3, A4, A5> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf5)<R, T, A1, A2, A3, A4, A5>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> _mfi::BOOST_MEM_FN_NAME(mf6)<R, T, A1, A2, A3, A4, A5, A6> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf6)<R, T, A1, A2, A3, A4, A5, A6>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> _mfi::BOOST_MEM_FN_NAME(cmf6)<R, T, A1, A2, A3, A4, A5, A6> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf6)<R, T, A1, A2, A3, A4, A5, A6>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> _mfi::BOOST_MEM_FN_NAME(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> _mfi::BOOST_MEM_FN_NAME(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> _mfi::BOOST_MEM_FN_NAME(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8))
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> _mfi::BOOST_MEM_FN_NAME(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) const)
|
||||
{
|
||||
return _mfi::BOOST_MEM_FN_NAME(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8>(f);
|
||||
}
|
||||
@@ -1,755 +0,0 @@
|
||||
//
|
||||
// bind/mem_fn_template.hpp
|
||||
//
|
||||
// Do not include this header directly
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
// mf0
|
||||
|
||||
template<class R, class T BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf0)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef T * argument_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) ())
|
||||
F f_;
|
||||
|
||||
template<class U> R call(U & u, T const *) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)();
|
||||
}
|
||||
|
||||
template<class U> R call(U & u, void const *) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(mf0)(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (p->*f_)();
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u);
|
||||
}
|
||||
|
||||
R operator()(T & t) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)();
|
||||
}
|
||||
};
|
||||
|
||||
// cmf0
|
||||
|
||||
template<class R, class T BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf0)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef T const * argument_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) () const)
|
||||
F f_;
|
||||
|
||||
template<class U> R call(U & u, T const *) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)();
|
||||
}
|
||||
|
||||
template<class U> R call(U & u, void const *) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(cmf0)(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u);
|
||||
}
|
||||
|
||||
R operator()(T const & t) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)();
|
||||
}
|
||||
};
|
||||
|
||||
// mf1
|
||||
|
||||
template<class R, class T, class A1 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf1)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef T * first_argument_type;
|
||||
typedef A1 second_argument_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1))
|
||||
F f_;
|
||||
|
||||
template<class U, class B1> R call(U & u, T const *, B1 & b1) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1);
|
||||
}
|
||||
|
||||
template<class U, class B1> R call(U & u, void const *, B1 & b1) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(mf1)(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (p->*f_)(a1);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf1
|
||||
|
||||
template<class R, class T, class A1 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf1)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef T const * first_argument_type;
|
||||
typedef A1 second_argument_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1) const)
|
||||
F f_;
|
||||
|
||||
template<class U, class B1> R call(U & u, T const *, B1 & b1) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1);
|
||||
}
|
||||
|
||||
template<class U, class B1> R call(U & u, void const *, B1 & b1) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(cmf1)(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1);
|
||||
}
|
||||
};
|
||||
|
||||
// mf2
|
||||
|
||||
template<class R, class T, class A1, class A2 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf2)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2))
|
||||
F f_;
|
||||
|
||||
template<class U, class B1, class B2> R call(U & u, T const *, B1 & b1, B2 & b2) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1, b2);
|
||||
}
|
||||
|
||||
template<class U, class B1, class B2> R call(U & u, void const *, B1 & b1, B2 & b2) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(mf2)(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1, A2 a2) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (p->*f_)(a1, a2);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1, A2 a2) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1, A2 a2) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf2
|
||||
|
||||
template<class R, class T, class A1, class A2 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf2)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2) const)
|
||||
F f_;
|
||||
|
||||
template<class U, class B1, class B2> R call(U & u, T const *, B1 & b1, B2 & b2) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1, b2);
|
||||
}
|
||||
|
||||
template<class U, class B1, class B2> R call(U & u, void const *, B1 & b1, B2 & b2) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(cmf2)(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1, A2 a2) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1, A2 a2) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2);
|
||||
}
|
||||
};
|
||||
|
||||
// mf3
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf3)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3))
|
||||
F f_;
|
||||
|
||||
template<class U, class B1, class B2, class B3> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3);
|
||||
}
|
||||
|
||||
template<class U, class B1, class B2, class B3> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(mf3)(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1, A2 a2, A3 a3) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1, A2 a2, A3 a3) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf3
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf3)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const)
|
||||
F f_;
|
||||
|
||||
template<class U, class B1, class B2, class B3> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3);
|
||||
}
|
||||
|
||||
template<class U, class B1, class B2, class B3> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(cmf3)(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1, A2 a2, A3 a3) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3);
|
||||
}
|
||||
};
|
||||
|
||||
// mf4
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf4)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4))
|
||||
F f_;
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4);
|
||||
}
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(mf4)(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf4
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf4)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const)
|
||||
F f_;
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4);
|
||||
}
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(cmf4)(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4);
|
||||
}
|
||||
};
|
||||
|
||||
// mf5
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf5)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5))
|
||||
F f_;
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5);
|
||||
}
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(mf5)(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf5
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf5)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const)
|
||||
F f_;
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5);
|
||||
}
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(cmf5)(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5);
|
||||
}
|
||||
};
|
||||
|
||||
// mf6
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf6)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6))
|
||||
F f_;
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6);
|
||||
}
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(mf6)(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf6
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf6)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const)
|
||||
F f_;
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6);
|
||||
}
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(cmf6)(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
};
|
||||
|
||||
// mf7
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf7)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7))
|
||||
F f_;
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7);
|
||||
}
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(mf7)(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf7
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf7)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const)
|
||||
F f_;
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7);
|
||||
}
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(cmf7)(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
};
|
||||
|
||||
// mf8
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf8)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8))
|
||||
F f_;
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8);
|
||||
}
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(mf8)(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf8
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf8)
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const)
|
||||
F f_;
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8);
|
||||
}
|
||||
|
||||
template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit BOOST_MEM_FN_NAME(cmf8)(F f): f_(f) {}
|
||||
|
||||
R operator()(T const * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
|
||||
{
|
||||
BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
//
|
||||
// bind/mem_fn_vw.hpp - void return helper wrappers
|
||||
//
|
||||
// Do not include this header directly
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
template<class R, class T> struct BOOST_MEM_FN_NAME(mf0): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)<R, T, R (BOOST_MEM_FN_CC T::*) ()>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) ();
|
||||
explicit BOOST_MEM_FN_NAME(mf0)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)<R, T, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T> struct BOOST_MEM_FN_NAME(cmf0): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)<R, T, R (BOOST_MEM_FN_CC T::*) () const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) () const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf0)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)<R, T, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1> struct BOOST_MEM_FN_NAME(mf1): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)<R, T, A1, R (BOOST_MEM_FN_CC T::*) (A1)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1);
|
||||
explicit BOOST_MEM_FN_NAME(mf1)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)<R, T, A1, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1> struct BOOST_MEM_FN_NAME(cmf1): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)<R, T, A1, R (BOOST_MEM_FN_CC T::*) (A1) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf1)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)<R, T, A1, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1, class A2> struct BOOST_MEM_FN_NAME(mf2): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)<R, T, A1, A2, R (BOOST_MEM_FN_CC T::*) (A1, A2)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2);
|
||||
explicit BOOST_MEM_FN_NAME(mf2)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)<R, T, A1, A2, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1, class A2> struct BOOST_MEM_FN_NAME(cmf2): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)<R, T, A1, A2, R (BOOST_MEM_FN_CC T::*) (A1, A2) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf2)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)<R, T, A1, A2, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3> struct BOOST_MEM_FN_NAME(mf3): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)<R, T, A1, A2, A3, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3);
|
||||
explicit BOOST_MEM_FN_NAME(mf3)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)<R, T, A1, A2, A3, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3> struct BOOST_MEM_FN_NAME(cmf3): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)<R, T, A1, A2, A3, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf3)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)<R, T, A1, A2, A3, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4> struct BOOST_MEM_FN_NAME(mf4): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)<R, T, A1, A2, A3, A4, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4);
|
||||
explicit BOOST_MEM_FN_NAME(mf4)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)<R, T, A1, A2, A3, A4, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4> struct BOOST_MEM_FN_NAME(cmf4): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)<R, T, A1, A2, A3, A4, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf4)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)<R, T, A1, A2, A3, A4, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5> struct BOOST_MEM_FN_NAME(mf5): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)<R, T, A1, A2, A3, A4, A5, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5);
|
||||
explicit BOOST_MEM_FN_NAME(mf5)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)<R, T, A1, A2, A3, A4, A5, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5> struct BOOST_MEM_FN_NAME(cmf5): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)<R, T, A1, A2, A3, A4, A5, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf5)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)<R, T, A1, A2, A3, A4, A5, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> struct BOOST_MEM_FN_NAME(mf6): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)<R, T, A1, A2, A3, A4, A5, A6, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6);
|
||||
explicit BOOST_MEM_FN_NAME(mf6)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)<R, T, A1, A2, A3, A4, A5, A6, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> struct BOOST_MEM_FN_NAME(cmf6): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)<R, T, A1, A2, A3, A4, A5, A6, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf6)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)<R, T, A1, A2, A3, A4, A5, A6, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct BOOST_MEM_FN_NAME(mf7): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7);
|
||||
explicit BOOST_MEM_FN_NAME(mf7)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct BOOST_MEM_FN_NAME(cmf7): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf7)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7, F>(f) {}
|
||||
};
|
||||
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct BOOST_MEM_FN_NAME(mf8): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7, A8)>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8);
|
||||
explicit BOOST_MEM_FN_NAME(mf8)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, F>(f) {}
|
||||
};
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct BOOST_MEM_FN_NAME(cmf8): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7, A8) const>
|
||||
{
|
||||
typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const;
|
||||
explicit BOOST_MEM_FN_NAME(cmf8)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, F>(f) {}
|
||||
};
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
#ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED
|
||||
#define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// bind/placeholders.hpp - _N definitions
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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/bind.html for documentation.
|
||||
//
|
||||
|
||||
#include <boost/bind/arg.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
|
||||
static inline boost::arg<1> _1() { return boost::arg<1>(); }
|
||||
static inline boost::arg<2> _2() { return boost::arg<2>(); }
|
||||
static inline boost::arg<3> _3() { return boost::arg<3>(); }
|
||||
static inline boost::arg<4> _4() { return boost::arg<4>(); }
|
||||
static inline boost::arg<5> _5() { return boost::arg<5>(); }
|
||||
static inline boost::arg<6> _6() { return boost::arg<6>(); }
|
||||
static inline boost::arg<7> _7() { return boost::arg<7>(); }
|
||||
static inline boost::arg<8> _8() { return boost::arg<8>(); }
|
||||
static inline boost::arg<9> _9() { return boost::arg<9>(); }
|
||||
|
||||
#elif (defined(BOOST_MSVC) && BOOST_MSVC <= 1300) || (defined(__DECCXX_VER) && __DECCXX_VER <= 60590031) || defined(__MWERKS__)
|
||||
|
||||
static boost::arg<1> _1;
|
||||
static boost::arg<2> _2;
|
||||
static boost::arg<3> _3;
|
||||
static boost::arg<4> _4;
|
||||
static boost::arg<5> _5;
|
||||
static boost::arg<6> _6;
|
||||
static boost::arg<7> _7;
|
||||
static boost::arg<8> _8;
|
||||
static boost::arg<9> _9;
|
||||
|
||||
#else
|
||||
|
||||
boost::arg<1> _1;
|
||||
boost::arg<2> _2;
|
||||
boost::arg<3> _3;
|
||||
boost::arg<4> _4;
|
||||
boost::arg<5> _5;
|
||||
boost::arg<6> _6;
|
||||
boost::arg<7> _7;
|
||||
boost::arg<8> _8;
|
||||
boost::arg<9> _9;
|
||||
|
||||
#endif
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
#endif // #ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED
|
||||
@@ -1,145 +0,0 @@
|
||||
#ifndef BOOST_BIND_PROTECT_HPP_INCLUDED
|
||||
#define BOOST_BIND_PROTECT_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// protect.hpp
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace _bi
|
||||
{
|
||||
|
||||
template<class F> class protected_bind_t
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename F::result_type result_type;
|
||||
|
||||
explicit protected_bind_t(F f): f_(f)
|
||||
{
|
||||
}
|
||||
|
||||
result_type operator()()
|
||||
{
|
||||
return f_();
|
||||
}
|
||||
|
||||
result_type operator()() const
|
||||
{
|
||||
return f_();
|
||||
}
|
||||
|
||||
template<class A1> result_type operator()(A1 & a1)
|
||||
{
|
||||
return f_(a1);
|
||||
}
|
||||
|
||||
template<class A1> result_type operator()(A1 & a1) const
|
||||
{
|
||||
return f_(a1);
|
||||
}
|
||||
|
||||
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2)
|
||||
{
|
||||
return f_(a1, a2);
|
||||
}
|
||||
|
||||
template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) const
|
||||
{
|
||||
return f_(a1, a2);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3)
|
||||
{
|
||||
return f_(a1, a2, a3);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3) const
|
||||
{
|
||||
return f_(a1, a2, a3);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4)
|
||||
{
|
||||
return f_(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9)
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
}
|
||||
|
||||
template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const
|
||||
{
|
||||
return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
};
|
||||
|
||||
} // namespace _bi
|
||||
|
||||
template<class F> _bi::protected_bind_t<F> protect(F f)
|
||||
{
|
||||
return _bi::protected_bind_t<F>(f);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_BIND_PROTECT_HPP_INCLUDED
|
||||
@@ -1,17 +1,16 @@
|
||||
#ifndef BOOST_MEM_FN_HPP_INCLUDED
|
||||
#define BOOST_MEM_FN_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#if _MSC_VER >= 1020
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// mem_fn.hpp - a generalization of std::mem_fun[_ref]
|
||||
//
|
||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright (c) 2001 David Abrahams
|
||||
// Version 1.02.0001 (2001-08-30)
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all copies.
|
||||
@@ -21,300 +20,683 @@
|
||||
// See http://www.boost.org/libs/bind/mem_fn.html for documentation.
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/get_pointer.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
#if defined(BOOST_NO_VOID_RETURNS)
|
||||
// get_pointer(p) extracts a ->* capable pointer from p
|
||||
|
||||
#define BOOST_MEM_FN_CLASS_F , class F
|
||||
#define BOOST_MEM_FN_TYPEDEF(X)
|
||||
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();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
namespace _mfi // mem_fun_impl
|
||||
{
|
||||
|
||||
template<class V> struct mf
|
||||
{
|
||||
// mf0
|
||||
|
||||
#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
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall
|
||||
#define BOOST_MEM_FN_CC __fastcall
|
||||
|
||||
#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
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall
|
||||
#define BOOST_MEM_FN_CC __fastcall
|
||||
|
||||
#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>
|
||||
|
||||
#undef BOOST_MEM_FN_CLASS_F
|
||||
#undef BOOST_MEM_FN_TYPEDEF_F
|
||||
|
||||
#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
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X##_fastcall
|
||||
#define BOOST_MEM_FN_NAME2(X) inner_##X##_fastcall
|
||||
#define BOOST_MEM_FN_CC __fastcall
|
||||
|
||||
#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
|
||||
|
||||
#define BOOST_MEM_FN_CLASS_F
|
||||
#define BOOST_MEM_FN_TYPEDEF(X) typedef X;
|
||||
|
||||
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
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X##_fastcall
|
||||
#define BOOST_MEM_FN_CC __fastcall
|
||||
|
||||
#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
|
||||
|
||||
#undef BOOST_MEM_FN_CLASS_F
|
||||
#undef BOOST_MEM_FN_TYPEDEF
|
||||
|
||||
#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
|
||||
|
||||
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
|
||||
|
||||
#define BOOST_MEM_FN_NAME(X) X##_fastcall
|
||||
#define BOOST_MEM_FN_CC __fastcall
|
||||
|
||||
#include <boost/bind/mem_fn_cc.hpp>
|
||||
|
||||
#undef BOOST_MEM_FN_NAME
|
||||
#undef BOOST_MEM_FN_CC
|
||||
|
||||
#endif
|
||||
|
||||
// data member support
|
||||
|
||||
namespace _mfi
|
||||
{
|
||||
|
||||
template<class R, class T> class dm
|
||||
template<class R, class T> class mf0
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R const & result_type;
|
||||
typedef T const * argument_type;
|
||||
typedef R result_type;
|
||||
typedef T * first_argument_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F);
|
||||
typedef R (T::*F) ();
|
||||
F f_;
|
||||
|
||||
template<class U> R const & call(U & u, T const *) const
|
||||
{
|
||||
return (u.*f_);
|
||||
}
|
||||
|
||||
template<class U> R & call(U & u, T *) const
|
||||
{
|
||||
return (u.*f_);
|
||||
}
|
||||
|
||||
template<class U> R const & call(U & u, void const *) const
|
||||
{
|
||||
return (get_pointer(u)->*f_);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit dm(F f): f_(f) {}
|
||||
explicit mf0(F f): f_(f) {}
|
||||
|
||||
R & operator()(T * p) const
|
||||
R operator()(T * p) const
|
||||
{
|
||||
return (p->*f_);
|
||||
return (p->*f_)();
|
||||
}
|
||||
|
||||
R const & operator()(T const * p) const
|
||||
template<class U> R operator()(U & u) const
|
||||
{
|
||||
return (p->*f_);
|
||||
return (get_pointer(u)->*f_)();
|
||||
}
|
||||
|
||||
template<class U> R const & operator()(U & u) const
|
||||
R operator()(T & t) const
|
||||
{
|
||||
return call(u, &u);
|
||||
return (t.*f_)();
|
||||
}
|
||||
};
|
||||
|
||||
// cmf0
|
||||
|
||||
template<class R, class T> class cmf0
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef T const * first_argument_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) () const;
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit cmf0(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)();
|
||||
}
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
||||
|
||||
R & operator()(T & t) const
|
||||
R operator()(T const & t) const
|
||||
{
|
||||
return (t.*f_);
|
||||
return (t.*f_)();
|
||||
}
|
||||
};
|
||||
|
||||
// mf1
|
||||
|
||||
template<class R, class T, class A1> class mf1
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef T * first_argument_type;
|
||||
typedef A1 second_argument_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1);
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit mf1(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1) const
|
||||
{
|
||||
return (p->*f_)(a1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
R const & operator()(T const & t) const
|
||||
template<class U> R operator()(U & u, A1 a1) const
|
||||
{
|
||||
return (t.*f_);
|
||||
return (get_pointer(u)->*f_)(a1);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1) const
|
||||
{
|
||||
return (t.*f_)(a1);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf1
|
||||
|
||||
template<class R, class T, class A1> class cmf1
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
typedef T const * first_argument_type;
|
||||
typedef A1 second_argument_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1) const;
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit cmf1(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1) const
|
||||
{
|
||||
return (t.*f_)(a1);
|
||||
}
|
||||
};
|
||||
|
||||
// mf2
|
||||
|
||||
template<class R, class T, class A1, class A2> class mf2
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1, A2);
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit mf2(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1, A2 a2) const
|
||||
{
|
||||
return (p->*f_)(a1, a2);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1, A2 a2) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1, a2);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1, A2 a2) const
|
||||
{
|
||||
return (t.*f_)(a1, a2);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf2
|
||||
|
||||
template<class R, class T, class A1, class A2> class cmf2
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1, A2) const;
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit cmf2(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1, A2 a2) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1, a2);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1, A2 a2) const
|
||||
{
|
||||
return (t.*f_)(a1, a2);
|
||||
}
|
||||
};
|
||||
|
||||
// mf3
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3> class mf3
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1, A2, A3);
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit mf3(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1, A2 a2, A3 a3) const
|
||||
{
|
||||
return (p->*f_)(a1, a2, a3);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1, a2, a3);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1, A2 a2, A3 a3) const
|
||||
{
|
||||
return (t.*f_)(a1, a2, a3);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf3
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3> class cmf3
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1, A2, A3) const;
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit cmf3(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1, a2, a3);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1, A2 a2, A3 a3) const
|
||||
{
|
||||
return (t.*f_)(a1, a2, a3);
|
||||
}
|
||||
};
|
||||
|
||||
// mf4
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4> class mf4
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1, A2, A3, A4);
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit mf4(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4) const
|
||||
{
|
||||
return (p->*f_)(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4) const
|
||||
{
|
||||
return (t.*f_)(a1, a2, a3, a4);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf4
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4> class cmf4
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1, A2, A3, A4) const;
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit cmf4(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4) const
|
||||
{
|
||||
return (t.*f_)(a1, a2, a3, a4);
|
||||
}
|
||||
};
|
||||
|
||||
// mf5
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5> class mf5
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1, A2, A3, A4, A5);
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit mf5(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
|
||||
{
|
||||
return (p->*f_)(a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
|
||||
{
|
||||
return (t.*f_)(a1, a2, a3, a4, a5);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf5
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5> class cmf5
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1, A2, A3, A4, A5) const;
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit cmf5(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
|
||||
{
|
||||
return (t.*f_)(a1, a2, a3, a4, a5);
|
||||
}
|
||||
};
|
||||
|
||||
// mf6
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> class mf6
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1, A2, A3, A4, A5, A6);
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit mf6(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
|
||||
{
|
||||
return (p->*f_)(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
|
||||
{
|
||||
return (t.*f_)(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf6
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> class cmf6
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1, A2, A3, A4, A5, A6) const;
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit cmf6(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
|
||||
{
|
||||
return (t.*f_)(a1, a2, a3, a4, a5, a6);
|
||||
}
|
||||
};
|
||||
|
||||
// mf7
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> class mf7
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1, A2, A3, A4, A5, A6, A7);
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit mf7(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
|
||||
{
|
||||
return (p->*f_)(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
|
||||
{
|
||||
return (t.*f_)(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf7
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> class cmf7
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1, A2, A3, A4, A5, A6, A7) const;
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit cmf7(F f): f_(f) {}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
|
||||
{
|
||||
return (t.*f_)(a1, a2, a3, a4, a5, a6, a7);
|
||||
}
|
||||
};
|
||||
|
||||
// mf8
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> class mf8
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1, A2, A3, A4, A5, A6, A7, A8);
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit mf8(F f): f_(f) {}
|
||||
|
||||
R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
|
||||
{
|
||||
return (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
|
||||
{
|
||||
return (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
};
|
||||
|
||||
// cmf8
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> class cmf8
|
||||
{
|
||||
public:
|
||||
|
||||
typedef R result_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef R (T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const;
|
||||
F f_;
|
||||
|
||||
public:
|
||||
|
||||
explicit cmf8(F f): f_(f) {}
|
||||
|
||||
R operator()(T const * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
|
||||
{
|
||||
return (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
|
||||
{
|
||||
return (get_pointer(u)->*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
|
||||
R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
|
||||
{
|
||||
return (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace _mfi
|
||||
|
||||
template<class R, class T> _mfi::dm<R, T> mem_fn(R T::*f)
|
||||
// mem_fn
|
||||
|
||||
template<class R, class T> _mfi::mf0<R, T> mem_fn(R (T::*f) ())
|
||||
{
|
||||
return _mfi::dm<R, T>(f);
|
||||
return _mfi::mf0<R, T>(f);
|
||||
}
|
||||
|
||||
template<class R, class T> _mfi::cmf0<R, T> mem_fn(R (T::*f) () const)
|
||||
{
|
||||
return _mfi::cmf0<R, T>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1> _mfi::mf1<R, T, A1> mem_fn(R (T::*f) (A1))
|
||||
{
|
||||
return _mfi::mf1<R, T, A1>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1> _mfi::cmf1<R, T, A1> mem_fn(R (T::*f) (A1) const)
|
||||
{
|
||||
return _mfi::cmf1<R, T, A1>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2> _mfi::mf2<R, T, A1, A2> mem_fn(R (T::*f) (A1, A2))
|
||||
{
|
||||
return _mfi::mf2<R, T, A1, A2>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2> _mfi::cmf2<R, T, A1, A2> mem_fn(R (T::*f) (A1, A2) const)
|
||||
{
|
||||
return _mfi::cmf2<R, T, A1, A2>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3> _mfi::mf3<R, T, A1, A2, A3> mem_fn(R (T::*f) (A1, A2, A3))
|
||||
{
|
||||
return _mfi::mf3<R, T, A1, A2, A3>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3> _mfi::cmf3<R, T, A1, A2, A3> mem_fn(R (T::*f) (A1, A2, A3) const)
|
||||
{
|
||||
return _mfi::cmf3<R, T, A1, A2, A3>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4> _mfi::mf4<R, T, A1, A2, A3, A4> mem_fn(R (T::*f) (A1, A2, A3, A4))
|
||||
{
|
||||
return _mfi::mf4<R, T, A1, A2, A3, A4>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4> _mfi::cmf4<R, T, A1, A2, A3, A4> mem_fn(R (T::*f) (A1, A2, A3, A4) const)
|
||||
{
|
||||
return _mfi::cmf4<R, T, A1, A2, A3, A4>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5> _mfi::mf5<R, T, A1, A2, A3, A4, A5> mem_fn(R (T::*f) (A1, A2, A3, A4, A5))
|
||||
{
|
||||
return _mfi::mf5<R, T, A1, A2, A3, A4, A5>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5> _mfi::cmf5<R, T, A1, A2, A3, A4, A5> mem_fn(R (T::*f) (A1, A2, A3, A4, A5) const)
|
||||
{
|
||||
return _mfi::cmf5<R, T, A1, A2, A3, A4, A5>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> _mfi::mf6<R, T, A1, A2, A3, A4, A5, A6> mem_fn(R (T::*f) (A1, A2, A3, A4, A5, A6))
|
||||
{
|
||||
return _mfi::mf6<R, T, A1, A2, A3, A4, A5, A6>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> _mfi::cmf6<R, T, A1, A2, A3, A4, A5, A6> mem_fn(R (T::*f) (A1, A2, A3, A4, A5, A6) const)
|
||||
{
|
||||
return _mfi::cmf6<R, T, A1, A2, A3, A4, A5, A6>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> _mfi::mf7<R, T, A1, A2, A3, A4, A5, A6, A7> mem_fn(R (T::*f) (A1, A2, A3, A4, A5, A6, A7))
|
||||
{
|
||||
return _mfi::mf7<R, T, A1, A2, A3, A4, A5, A6, A7>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> _mfi::cmf7<R, T, A1, A2, A3, A4, A5, A6, A7> mem_fn(R (T::*f) (A1, A2, A3, A4, A5, A6, A7) const)
|
||||
{
|
||||
return _mfi::cmf7<R, T, A1, A2, A3, A4, A5, A6, A7>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> _mfi::mf8<R, T, A1, A2, A3, A4, A5, A6, A7, A8> mem_fn(R (T::*f) (A1, A2, A3, A4, A5, A6, A7, A8))
|
||||
{
|
||||
return _mfi::mf8<R, T, A1, A2, A3, A4, A5, A6, A7, A8>(f);
|
||||
}
|
||||
|
||||
template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> _mfi::cmf8<R, T, A1, A2, A3, A4, A5, A6, A7, A8> mem_fn(R (T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) const)
|
||||
{
|
||||
return _mfi::cmf8<R, T, A1, A2, A3, A4, A5, A6, A7, A8>(f);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
10
index.html
10
index.html
@@ -1,10 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; URL=bind.html">
|
||||
</head>
|
||||
<body>
|
||||
Automatic redirection failed, please go to
|
||||
<a href="bind.html">bind.html</a> or
|
||||
<a href="mem_fn.html">mem_fn.html</a>.
|
||||
</body>
|
||||
</html>
|
||||
586
mem_fn.html
586
mem_fn.html
@@ -1,98 +1,54 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost: mem_fn.hpp documentation</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
<body bgcolor="white" style="MARGIN-LEFT: 5%; MARGIN-RIGHT: 5%">
|
||||
<table border="0" width="100%">
|
||||
<tr>
|
||||
<td width="277">
|
||||
<img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86">
|
||||
</td>
|
||||
<td align="middle">
|
||||
<h1>mem_fn.hpp</h1>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" height="64"> </td>
|
||||
</tr>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>Boost: mem_fn.hpp documentation</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="White">
|
||||
|
||||
<table border="0" width="100%">
|
||||
<tr>
|
||||
<td width="277">
|
||||
<img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" WIDTH="277" HEIGHT="86">
|
||||
</td>
|
||||
<td align="center">
|
||||
<table border="0">
|
||||
<tr><td nowrap><h1>mem_fn.hpp</h1></td></tr>
|
||||
<tr><td align="right" nowrap><small> 1.02.0001 (2001-08-30)</small></td></tr>
|
||||
</table>
|
||||
<h2>Contents</h2>
|
||||
<h3 style="MARGIN-LEFT: 20pt"><a href="#Purpose">Purpose</a></h3>
|
||||
<h3 style="MARGIN-LEFT: 20pt"><a href="#FAQ">Frequently Asked Questions</a></h3>
|
||||
<h4 style="MARGIN-LEFT: 40pt"><a href="#Q1">Can <b>mem_fn</b> be used instead of the
|
||||
standard <b>std::mem_fun[_ref]</b> adaptors?</a></h4>
|
||||
<h4 style="MARGIN-LEFT: 40pt"><a href="#Q2">Should I replace every occurence of <b>std::mem_fun[_ref]</b>
|
||||
with <b>mem_fn</b> in my existing code?</a></h4>
|
||||
<h4 style="MARGIN-LEFT: 40pt"><a href="#Q3">Does <b>mem_fn</b> work with COM methods?</a></h4>
|
||||
<h4 style="MARGIN-LEFT: 40pt"><a href="#Q4">Why isn't BOOST_MEM_FN_ENABLE_STDCALL
|
||||
defined automatically?</a></h4>
|
||||
<h3 style="MARGIN-LEFT: 20pt"><a href="#Interface">Interface</a></h3>
|
||||
<h4 style="MARGIN-LEFT: 40pt"><a href="#Synopsis">Synopsis</a></h4>
|
||||
<h4 style="MARGIN-LEFT: 40pt"><a href="#CommonRequirements">Common requirements</a></h4>
|
||||
<h4 style="MARGIN-LEFT: 40pt"><a href="#get_pointer">get_pointer</a></h4>
|
||||
<h4 style="MARGIN-LEFT: 40pt"><a href="#mem_fn">mem_fn</a></h4>
|
||||
<h3 style="MARGIN-LEFT: 20pt"><a href="#Implementation">Implementation</a></h3>
|
||||
<h4 style="MARGIN-LEFT: 40pt"><a href="#Files">Files</a></h4>
|
||||
<h4 style="MARGIN-LEFT: 40pt"><a href="#Dependencies">Dependencies</a></h4>
|
||||
<h4 style="MARGIN-LEFT: 40pt"><a href="#NumberOfArguments">Number of Arguments</a></h4>
|
||||
<h4 style="MARGIN-LEFT: 40pt"><a href="#stdcall">"__stdcall" and
|
||||
"__fastcall" Support</a></h4>
|
||||
<h3 style="MARGIN-LEFT: 20pt"><a href="#Acknowledgements">Acknowledgements</a></h3>
|
||||
<h2><a name="Purpose">Purpose</a></h2>
|
||||
<p>
|
||||
<b>boost::mem_fn</b> is a generalization of the standard functions <b>std::mem_fun</b>
|
||||
and <b>std::mem_fun_ref</b>. It supports member function pointers with more
|
||||
than one argument, and the returned function object can take a pointer, a
|
||||
reference, or a smart pointer to an object instance as its first argument. <STRONG>mem_fn</STRONG>
|
||||
also supports pointers to data members by treating them as functions taking no
|
||||
arguments and returning a (const) reference to the member.
|
||||
</p>
|
||||
<p>
|
||||
The purpose of <b>mem_fn</b> is twofold. First, it allows users to invoke a
|
||||
member function on a container with the familiar
|
||||
</p>
|
||||
<pre>
|
||||
std::for_each(v.begin(), v.end(), boost::mem_fn(&Shape::draw));
|
||||
</pre>
|
||||
<p>
|
||||
syntax, even when the container stores smart pointers.
|
||||
</p>
|
||||
<p>
|
||||
Second, it can be used as a building block by library developers that want to
|
||||
treat a pointer to member function as a function object. A library might define
|
||||
an enhanced <b>for_each</b> algorithm with an overload of the form:
|
||||
</p>
|
||||
<pre>
|
||||
template<class It, class R, class T> void for_each(It first, It last, R (T::*pmf) ())
|
||||
{
|
||||
std::for_each(first, last, boost::mem_fn(pmf));
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
that will allow the convenient syntax:
|
||||
</p>
|
||||
<pre>
|
||||
for_each(v.begin(), v.end(), &Shape::draw);
|
||||
</pre>
|
||||
<p>
|
||||
When documenting the feature, the library author will simply state:
|
||||
</p>
|
||||
<h4 style="MARGIN-LEFT: 20pt">template<class It, class R, class T> void
|
||||
for_each(It first, It last, R (T::*pmf) ());</h4>
|
||||
<p style="MARGIN-LEFT: 20pt">
|
||||
<b>Effects:</b> equivalent to std::for_each(first, last, boost::mem_fn(pmf));
|
||||
</p>
|
||||
<p>
|
||||
where <b>boost::mem_fn</b> can be a link to this page. See <a href="bind.html">the
|
||||
documentation of <b>bind</b></a> for an example.
|
||||
</p>
|
||||
<p>
|
||||
<b>mem_fn</b> takes one argument, a pointer to a member, and returns a function
|
||||
object suitable for use with standard or user-defined algorithms:
|
||||
</p>
|
||||
<pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" height="64"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2>Files</h2>
|
||||
<ul>
|
||||
<li><a href="../../boost/mem_fn.hpp">mem_fn.hpp</a> (implementation)
|
||||
<li><a href="mem_fn_test.cpp">mem_fn_test.cpp</a> (test)
|
||||
</ul>
|
||||
|
||||
<h2>Purpose</h2>
|
||||
|
||||
<p>
|
||||
<b>boost::mem_fn</b> is a generalization of the standard functions
|
||||
<b>std::mem_fun</b> and <b>std::mem_fun_ref</b>. It supports member
|
||||
function pointers with more than one argument, and the returned function
|
||||
object can take a pointer, a reference, or a smart pointer to an object
|
||||
instance as its first argument.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>mem_fn</b> takes one argument, a pointer to a member function, and
|
||||
returns a function object suitable for use with standard or user-defined
|
||||
algorithms:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
struct X
|
||||
{
|
||||
void f();
|
||||
@@ -113,287 +69,199 @@ void k(std::vector<boost::shared_ptr<X> > const & v)
|
||||
std::for_each(v.begin(), v.end(), boost::mem_fn(&X::f));
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
The returned function object takes the same arguments as the input member
|
||||
function plus a "flexible" first argument that represents the object instance.
|
||||
</p>
|
||||
<p>
|
||||
When the function object is invoked with a first argument <b>x</b> that is
|
||||
neither a pointer nor a reference to the appropriate class (<b>X</b> in the
|
||||
example above), it uses <tt>get_pointer(x)</tt> to obtain a pointer from <b>x</b>.
|
||||
Library authors can "register" their smart pointer classes by supplying an
|
||||
appropriate <b>get_pointer</b> overload, allowing <b>mem_fn</b> to recognize
|
||||
and support them.
|
||||
</p>
|
||||
<p>
|
||||
[Note: <b>get_pointer</b> is not restricted to return a pointer. Any object
|
||||
that can be used in a member function call expression <tt>(x->*pmf)(...)</tt>
|
||||
will work.]
|
||||
</p>
|
||||
<p>
|
||||
[Note: the library uses an unqualified call to <b>get_pointer</b>. Therefore,
|
||||
it will find, through argument-dependent lookup, <b>get_pointer</b> overloads
|
||||
that are defined in the same namespace as the corresponding smart pointer
|
||||
class, in addition to any <b>boost::get_pointer</b> overloads.]
|
||||
</p>
|
||||
<p>
|
||||
All function objects returned by <b>mem_fn</b> expose a <b>result_type</b> typedef
|
||||
that represents the return type of the member function. For data members, <STRONG>result_type</STRONG>
|
||||
is defined as a const reference to the type of the member.
|
||||
</p>
|
||||
<h2><a name="FAQ">Frequently Asked Questions</a></h2>
|
||||
<h3><a name="Q1">Can <b>mem_fn</b> be used instead of the standard <b>std::mem_fun[_ref]</b>
|
||||
adaptors?</a></h3>
|
||||
<p>
|
||||
Yes. For simple uses, <b>mem_fn</b> provides additional functionality that the
|
||||
standard adaptors do not. Complicated expressions that use <b>std::bind1st</b>, <b>std::bind2nd</b>
|
||||
or <a href="../compose/index.htm"><b>Boost.Compose</b></a> along with the
|
||||
standard adaptors can be rewritten using <a href="bind.html"><b>boost::bind</b></a>
|
||||
that automatically takes advantage of <b>mem_fn</b>.
|
||||
</p>
|
||||
<h3><a name="Q2">Should I replace every occurence of <b>std::mem_fun[_ref]</b> with <b>mem_fn</b>
|
||||
in my existing code?</a></h3>
|
||||
<p>
|
||||
No, unless you have good reasons to do so. <b>mem_fn</b> is not 100% compatible
|
||||
with the standard adaptors, although it comes pretty close. In particular, <b>mem_fn</b>
|
||||
does not return objects of type <b>std::[const_]mem_fun[1][_ref]_t</b>, as the
|
||||
standard adaptors do, and it is not possible to fully describe the type of the
|
||||
first argument using the standard <b>argument_type</b> and <b>first_argument_type</b>
|
||||
nested typedefs. Libraries that need adaptable function objects in order to
|
||||
function might not like <b>mem_fn</b>.
|
||||
</p>
|
||||
<h3><a name="Q3">Does <b>mem_fn</b> work with COM methods?</a></h3>
|
||||
<p>
|
||||
Yes, if you <a href="#stdcall">#define BOOST_MEM_FN_ENABLE_STDCALL</a>.
|
||||
</p>
|
||||
<h3><a name="Q4">Why isn't BOOST_MEM_FN_ENABLE_STDCALL defined automatically?</a></h3>
|
||||
<p>
|
||||
Non-portable extensions, in general, should default to off to prevent vendor
|
||||
lock-in. Had BOOST_MEM_FN_ENABLE_STDCALL been defined automatically, you could
|
||||
have accidentally taken advantage of it without realizing that your code is,
|
||||
perhaps, no longer portable.
|
||||
</p>
|
||||
<h2><a name="Interface">Interface</a></h2>
|
||||
<h3><a name="Synopsis">Synopsis</a></h3>
|
||||
<pre>
|
||||
|
||||
<p>
|
||||
The returned function object takes the same arguments as the input member
|
||||
function plus a "flexible" first argument that represents the object instance.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When the function object is invoked with a first argument <b>x</b> that is
|
||||
neither a pointer nor a reference to the appropriate class (<b>X</b> in the
|
||||
example above), it uses <tt>get_pointer(x)</tt> to obtain a pointer from
|
||||
<b>x</b>. Library authors can "register" their smart pointer classes by
|
||||
supplying an appropriate <b>get_pointer</b> overload, allowing <b>mem_fn</b>
|
||||
to recognize and support them.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
A <b>get_pointer</b> overload for <b>boost::shared_ptr</b> is supplied.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
[Note: <b>get_pointer</b> is not restricted to return a pointer. Any object
|
||||
that can be used in a member function call expression <tt>(x->*pmf)(...)</tt>
|
||||
will work.]
|
||||
</p>
|
||||
|
||||
<p>
|
||||
[Note: the library uses an unqualified call to <b>get_pointer</b>. Therefore,
|
||||
it will find, through argument-dependent lookup, <b>get_pointer</b> overloads
|
||||
that are defined in the same namespace as the corresponding smart pointer
|
||||
class, in addition to any <b>boost::get_pointer</b> overloads.]
|
||||
</p>
|
||||
|
||||
<p>
|
||||
All function objects returned by <b>mem_fn</b> expose a <b>result_type</b>
|
||||
typedef that represents the return type of the member function.
|
||||
</p>
|
||||
|
||||
<h2>Interface</h2>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
|
||||
<pre>
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<class T> T * <a href="#get_pointer_1">get_pointer</a>(T * p);
|
||||
|
||||
template<class R, class T> <i>unspecified-1</i> <a href="#mem_fn_1">mem_fn</a>(R (T::*pmf) ());
|
||||
template<class T> T * <a href="#get_pointer_2">get_pointer</a>(shared_ptr<T> const & p);
|
||||
|
||||
template<class R, class T> <i>unspecified-2</i> <a href="#mem_fn_2">mem_fn</a>(R (T::*pmf) () const);
|
||||
template<class R, class T> <i>implementation-defined-1</i> <a href="#mem_fn_1">mem_fn</a>(R (T::*pmf) ());
|
||||
|
||||
template<class R, class T> <i>unspecified-2-1</i> <a href="#mem_fn_2_1">mem_fn</a>(R T::*pm);
|
||||
template<class R, class T> <i>implementation-defined-2</i> <a href="#mem_fn_2">mem_fn</a>(R (T::*pmf) () const);
|
||||
|
||||
template<class R, class T, class A1> <i>unspecified-3</i> <a href="#mem_fn_3">mem_fn</a>(R (T::*pmf) (A1));
|
||||
template<class R, class T, class A1> <i>implementation-defined-3</i> <a href="#mem_fn_3">mem_fn</a>(R (T::*pmf) (A1));
|
||||
|
||||
template<class R, class T, class A1> <i>unspecified-4</i> <a href="#mem_fn_4">mem_fn</a>(R (T::*pmf) (A1) const);
|
||||
template<class R, class T, class A1> <i>implementation-defined-4</i> <a href="#mem_fn_4">mem_fn</a>(R (T::*pmf) (A1) const);
|
||||
|
||||
template<class R, class T, class A1, class A2> <i>unspecified-5</i> <a href="#mem_fn_5">mem_fn</a>(R (T::*pmf) (A1, A2));
|
||||
template<class R, class T, class A1, class A2> <i>implementation-defined-5</i> <a href="#mem_fn_5">mem_fn</a>(R (T::*pmf) (A1, A2));
|
||||
|
||||
template<class R, class T, class A1, class A2> <i>unspecified-6</i> <a href="#mem_fn_6">mem_fn</a>(R (T::*pmf) (A1, A2) const);
|
||||
template<class R, class T, class A1, class A2> <i>implementation-defined-6</i> <a href="#mem_fn_6">mem_fn</a>(R (T::*pmf) (A1, A2) const);
|
||||
|
||||
// implementation defined number of additional overloads for more arguments
|
||||
|
||||
}
|
||||
</pre>
|
||||
<h3><a name="CommonRequirements">Common requirements</a></h3>
|
||||
<p>
|
||||
All <tt><i>unspecified-N</i></tt> types mentioned in the Synopsis are <b>CopyConstructible</b>
|
||||
and <b>Assignable</b>. Their copy constructors and assignment operators do not
|
||||
throw exceptions. <tt><i>unspecified-N</i>::result_type</tt> is defined as the
|
||||
return type of the member function pointer passed as an argument to <b>mem_fn</b>
|
||||
(<b>R</b> in the Synopsis.) <tt><i>unspecified-2-1</i>::result_type</tt> is
|
||||
defined as <tt>R const &</tt>.
|
||||
</p>
|
||||
<h3><a name="get_pointer">get_pointer</a></h3>
|
||||
<h4><a name="get_pointer_1">template<class T> T * get_pointer(T * p)</a></h4>
|
||||
<blockquote>
|
||||
<p>
|
||||
<b>Returns:</b> <tt>p</tt>.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
</blockquote>
|
||||
<h3><a name="mem_fn">mem_fn</a></h3>
|
||||
<h4><a name="mem_fn_1">template<class R, class T> <i>unspecified-1</i> mem_fn(R
|
||||
(T::*pmf) ())</a></h4>
|
||||
<blockquote>
|
||||
<p>
|
||||
<b>Returns:</b> a function object <i>f</i> such that the expression <tt><i>f(t)</i></tt>
|
||||
is equivalent to <tt>(t.*pmf)()</tt> when <i>t</i> is an l-value of type <STRONG>T </STRONG>
|
||||
or derived, <tt>(get_pointer(t)->*pmf)()</tt> otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
</blockquote>
|
||||
<h4><a name="mem_fn_2">template<class R, class T> <i>unspecified-2</i> mem_fn(R
|
||||
(T::*pmf) () const)</a></h4>
|
||||
<blockquote>
|
||||
<p>
|
||||
<b>Returns:</b> a function object <i>f</i> such that the expression <tt><i>f(t)</i></tt>
|
||||
is equivalent to <tt>(t.*pmf)()</tt> when <i>t</i> is of type <STRONG>T</STRONG>
|
||||
<EM>[const]<STRONG> </STRONG></EM>or derived, <tt>(get_pointer(t)->*pmf)()</tt>
|
||||
otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
</blockquote>
|
||||
<h4><a name="mem_fn_2_1">template<class R, class T> <i>unspecified-2-1</i> mem_fn(R
|
||||
T::*pm)</a></h4>
|
||||
<blockquote>
|
||||
<p>
|
||||
<b>Returns:</b> a function object <i>f</i> such that the expression <tt><i>f(t)</i></tt>
|
||||
is equivalent to <tt>t.*pm</tt> when <i>t</i> is of type <STRONG>T</STRONG> <EM>[const]<STRONG>
|
||||
</STRONG></EM>or derived, <tt>get_pointer(t)->*pm</tt> otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
</blockquote>
|
||||
<h4><a name="mem_fn_3">template<class R, class T, class A1> <i>unspecified-3</i> mem_fn(R
|
||||
(T::*pmf) (A1))</a></h4>
|
||||
<blockquote>
|
||||
<p>
|
||||
<b>Returns:</b> a function object <i>f</i> such that the expression <tt><i>f(t, a1)</i></tt>
|
||||
is equivalent to <tt>(t.*pmf)(a1)</tt> when <i>t</i> is an l-value of type <STRONG>T
|
||||
</STRONG>or derived, <tt>(get_pointer(t)->*pmf)(a1)</tt> otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
</blockquote>
|
||||
<h4><a name="mem_fn_4">template<class R, class T, class A1> <i>unspecified-4</i> mem_fn(R
|
||||
(T::*pmf) (A1) const)</a></h4>
|
||||
<blockquote>
|
||||
<p>
|
||||
<b>Returns:</b> a function object <i>f</i> such that the expression <tt><i>f(t, a1)</i></tt>
|
||||
is equivalent to <tt>(t.*pmf)(a1)</tt> when <i>t</i> is of type <STRONG>T</STRONG>
|
||||
<EM>[const]<STRONG> </STRONG></EM>or derived, <tt>(get_pointer(t)->*pmf)(a1)</tt>
|
||||
otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
</blockquote>
|
||||
<h4><a name="mem_fn_5">template<class R, class T, class A1, class A2> <i>unspecified-5</i>
|
||||
mem_fn(R (T::*pmf) (A1, A2))</a></h4>
|
||||
<blockquote>
|
||||
<p>
|
||||
<b>Returns:</b> a function object <i>f</i> such that the expression <tt><i>f(t, a1, a2)</i></tt>
|
||||
is equivalent to <tt>(t.*pmf)(a1, a2)</tt> when <i>t</i> is an l-value of type <STRONG>
|
||||
T</STRONG> or derived, <tt>(get_pointer(t)->*pmf)(a1, a2)</tt> otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
</blockquote>
|
||||
<h4><a name="mem_fn_6">template<class R, class T, class A1, class A2> <i>unspecified-6</i>
|
||||
mem_fn(R (T::*pmf) (A1, A2) const)</a></h4>
|
||||
<blockquote>
|
||||
<p>
|
||||
<b>Returns:</b> a function object <i>f</i> such that the expression <tt><i>f(t, a1, a2)</i></tt>
|
||||
is equivalent to <tt>(t.*pmf)(a1, a2)</tt> when <i>t</i> is of type <STRONG>T</STRONG>
|
||||
<EM>[const]</EM> or derived, <tt>(get_pointer(t)->*pmf)(a1, a2)</tt> otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
</blockquote>
|
||||
<h2><a name="Implementation">Implementation</a></h2>
|
||||
<h3><a name="Files">Files</a></h3>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="../../boost/mem_fn.hpp">boost/mem_fn.hpp</a>
|
||||
(main header)
|
||||
<li>
|
||||
<a href="../../boost/bind/mem_fn_cc.hpp">boost/bind/mem_fn_cc.hpp</a>
|
||||
(used by mem_fn.hpp, do not include directly)
|
||||
<li>
|
||||
<a href="../../boost/bind/mem_fn_vw.hpp">boost/bind/mem_fn_vw.hpp</a>
|
||||
(used by mem_fn.hpp, do not include directly)
|
||||
<li>
|
||||
<a href="../../boost/bind/mem_fn_template.hpp">boost/bind/mem_fn_template.hpp</a>
|
||||
(used by mem_fn.hpp, do not include directly)
|
||||
<li>
|
||||
<a href="test/mem_fn_test.cpp">libs/bind/test/mem_fn_test.cpp</a>
|
||||
(test)
|
||||
<li>
|
||||
<a href="test/mem_fn_derived_test.cpp">libs/bind/test/mem_fn_derived_test.cpp</a>
|
||||
(test with derived objects)
|
||||
<li>
|
||||
<a href="test/mem_fn_fastcall_test.cpp">libs/bind/test/mem_fn_fastcall_test.cpp</a>
|
||||
(test for __fastcall)
|
||||
<li>
|
||||
<a href="test/mem_fn_stdcall_test.cpp">libs/bind/test/mem_fn_stdcall_test.cpp</a>
|
||||
(test for __stdcall)
|
||||
<li>
|
||||
<a href="test/mem_fn_void_test.cpp">libs/bind/test/mem_fn_void_test.cpp</a> (test for
|
||||
void returns)</li>
|
||||
</ul>
|
||||
<h3><a name="Dependencies">Dependencies</a></h3>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="../config/config.htm">Boost.Config</a></li>
|
||||
</ul>
|
||||
<h3><a name="NumberOfArguments">Number of Arguments</a></h3>
|
||||
<p>
|
||||
This implementation supports member functions with up to eight arguments. This
|
||||
is not an inherent limitation of the design, but an implementation detail.
|
||||
</p>
|
||||
<h3><a name="stdcall">"__stdcall" and "__fastcall" Support</a></h3>
|
||||
<p>
|
||||
Some platforms allow several types of member functions that differ by their <b>calling
|
||||
convention</b> (the rules by which the function is invoked: how are
|
||||
arguments passed, how is the return value handled, and who cleans up the stack
|
||||
- if any.)
|
||||
</p>
|
||||
<p>
|
||||
For example, Windows API functions and COM interface member functions use a
|
||||
calling convention known as <b>__stdcall</b>. Borland VCL components use <STRONG>__fastcall</STRONG>.
|
||||
</p>
|
||||
<p>
|
||||
To use <b>mem_fn</b> with <b>__stdcall</b> member functions, <b>#define</b> the
|
||||
macro <b>BOOST_MEM_FN_ENABLE_STDCALL</b> before including, directly or
|
||||
indirectly, <b><boost/mem_fn.hpp></b>.
|
||||
</p>
|
||||
<P>To use <B>mem_fn</B> with <B>__fastcall</B> member functions, <B>#define</B> the
|
||||
macro <B>BOOST_MEM_FN_ENABLE_FASTCALL</B> before including, directly or
|
||||
indirectly, <B><boost/mem_fn.hpp></B>.
|
||||
</P>
|
||||
<P>[Note: this is a non-portable extension. It is not part of the interface.]
|
||||
</P>
|
||||
<p>
|
||||
[Note: Some compilers provide only minimal support for the <b>__stdcall</b> keyword.]
|
||||
</p>
|
||||
<h2><a name="Acknowledgements">Acknowledgements</a></h2>
|
||||
<p>
|
||||
Rene Jager's initial suggestion of using traits classes to make <b>mem_fn</b> adapt
|
||||
to user-defined smart pointers inspired the <b>get_pointer</b>-based design.
|
||||
</p>
|
||||
<p>
|
||||
Numerous improvements were suggested during the formal review period by Richard
|
||||
Crossley, Jens Maurer, Ed Brey, and others. Review manager was Darin Adler.
|
||||
</p>
|
||||
<p>
|
||||
Steve Anichini pointed out that COM interfaces use <b>__stdcall</b>.
|
||||
</p>
|
||||
<p>
|
||||
Dave Abrahams modified <b>bind</b> and <b>mem_fn</b> to support void returns on
|
||||
deficient compilers.
|
||||
</p>
|
||||
<p><br>
|
||||
<br>
|
||||
<br>
|
||||
<small>Copyright © 2001, 2002 by Peter Dimov and Multi Media Ltd. Permission
|
||||
to copy, use, modify, sell and distribute this document is granted provided
|
||||
this copyright notice appears in all copies. This document is provided "as is"
|
||||
without express or implied warranty, and with no claim as to its suitability
|
||||
for any purpose.</small></p>
|
||||
</body>
|
||||
|
||||
<h3>Common requirements</h3>
|
||||
|
||||
<p>
|
||||
All <tt><i>implementation-defined-N</i></tt> types mentioned in the Synopsis are
|
||||
<b>CopyConstructible</b> and <b>Assignable</b>.
|
||||
Their copy constructors and assignment operators do not throw exceptions.
|
||||
<tt><i>implementation-defined-N</i>::result_type</tt> is defined as
|
||||
the return type of the member function pointer passed as an argument to <b>mem_fn</b>
|
||||
(<b>R</b> in the Synopsis.)
|
||||
</p>
|
||||
|
||||
<h3>get_pointer</h3>
|
||||
|
||||
<h4><a name="get_pointer_1">template<class T> T * get_pointer(T * p)</a></h4>
|
||||
|
||||
<p>
|
||||
<b>Returns:</b> <tt>p</tt>.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
|
||||
<h4><a name="get_pointer_2">template<class T> T * get_pointer(shared_ptr<T> const & p)</a></h4>
|
||||
|
||||
<p>
|
||||
<b>Returns:</b> <tt>p.get()</tt>.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
|
||||
<h3>mem_fn</h3>
|
||||
|
||||
<h4><a name="mem_fn_1">template<class R, class T> <i>implementation-defined-1</i> mem_fn(R (T::*pmf) ())</a></h4>
|
||||
|
||||
<p>
|
||||
<b>Returns:</b> a function object <i>f</i> such that the expression
|
||||
<tt><i>f(t)</i></tt> is equivalent to <tt>(t.*pmf)()</tt> when <i>t</i>
|
||||
is an l-value of type <b>T</b>, <tt>(get_pointer(t)->*pmf)()</tt> otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
|
||||
<h4><a name="mem_fn_2">template<class R, class T> <i>implementation-defined-2</i> mem_fn(R (T::*pmf) () const)</a></h4>
|
||||
|
||||
<p>
|
||||
<b>Returns:</b> a function object <i>f</i> such that the expression
|
||||
<tt><i>f(t)</i></tt> is equivalent to <tt>(t.*pmf)()</tt> when <i>t</i>
|
||||
is of type <b>T <i>[</i>const<i>]</i></b>, <tt>(get_pointer(t)->*pmf)()</tt> otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
|
||||
<h4><a name="mem_fn_3">template<class R, class T, class A1> <i>implementation-defined-3</i> mem_fn(R (T::*pmf) (A1))</a></h4>
|
||||
|
||||
<p>
|
||||
<b>Returns:</b> a function object <i>f</i> such that the expression
|
||||
<tt><i>f(t, a1)</i></tt> is equivalent to <tt>(t.*pmf)(a1)</tt> when <i>t</i>
|
||||
is an l-value of type <b>T</b>, <tt>(get_pointer(t)->*pmf)(a1)</tt> otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
|
||||
<h4><a name="mem_fn_4">template<class R, class T, class A1> <i>implementation-defined-4</i> mem_fn(R (T::*pmf) (A1) const)</a></h4>
|
||||
|
||||
<p>
|
||||
<b>Returns:</b> a function object <i>f</i> such that the expression
|
||||
<tt><i>f(t, a1)</i></tt> is equivalent to <tt>(t.*pmf)(a1)</tt> when <i>t</i>
|
||||
is of type <b>T <i>[</i>const<i>]</i></b>, <tt>(get_pointer(t)->*pmf)(a1)</tt> otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
|
||||
<h4><a name="mem_fn_5">template<class R, class T, class A1, class A2> <i>implementation-defined-5</i> mem_fn(R (T::*pmf) (A1, A2))</a></h4>
|
||||
|
||||
<p>
|
||||
<b>Returns:</b> a function object <i>f</i> such that the expression
|
||||
<tt><i>f(t, a1, a2)</i></tt> is equivalent to <tt>(t.*pmf)(a1, a2)</tt> when <i>t</i>
|
||||
is an l-value of type <b>T</b>, <tt>(get_pointer(t)->*pmf)(a1, a2)</tt> otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
|
||||
<h4><a name="mem_fn_6">template<class R, class T, class A1, class A2> <i>implementation-defined-6</i> mem_fn(R (T::*pmf) (A1, A2) const)</a></h4>
|
||||
|
||||
<p>
|
||||
<b>Returns:</b> a function object <i>f</i> such that the expression
|
||||
<tt><i>f(t, a1, a2)</i></tt> is equivalent to <tt>(t.*pmf)(a1, a2)</tt> when <i>t</i>
|
||||
is of type <b>T <i>[</i>const<i>]</i></b>, <tt>(get_pointer(t)->*pmf)(a1, a2)</tt> otherwise.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
|
||||
<h2>Implementation</h2>
|
||||
|
||||
<p>
|
||||
This implementation supports member functions with up to eight arguments.
|
||||
This is not an inherent limitation of the design, but an implementation
|
||||
detail.
|
||||
</p>
|
||||
|
||||
<h2>Acknowledgements</h2>
|
||||
|
||||
<p>
|
||||
Rene Jager's initial suggestion of using traits classes to make
|
||||
<b>mem_fn</b> adapt to user-defined smart pointers inspired the
|
||||
<b>get_pointer</b>-based design.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Numerous improvements were suggested during the formal review period by
|
||||
Richard Crossley, Jens Maurer, Ed Brey, and others. Review manager
|
||||
was Darin Adler.
|
||||
</p>
|
||||
|
||||
|
||||
<p><br><br><br><small>Copyright © 2001 by Peter Dimov and Multi Media
|
||||
Ltd. Permission to copy, use, modify, sell and distribute this document is
|
||||
granted provided this copyright notice appears in all copies. This document
|
||||
is provided "as is" without express or implied warranty, and with
|
||||
no claim as to its suitability for any purpose.</small></p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#if defined(_MSC_VER) && !defined(__ICL)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
@@ -10,7 +8,9 @@
|
||||
//
|
||||
// mem_fn_test.cpp - a test for mem_fn.hpp
|
||||
//
|
||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||
// Version 1.02.0001 (2001-08-30)
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all copies.
|
||||
@@ -19,19 +19,9 @@
|
||||
//
|
||||
|
||||
#include <boost/mem_fn.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
#include <boost/smart_ptr.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
struct X
|
||||
{
|
||||
mutable unsigned int hash;
|
||||
@@ -181,5 +171,5 @@ int main()
|
||||
mem_fn(&X::g8)(pcx, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
return detect_errors(mem_fn(&X::hash)(x) == 17610 && mem_fn(&X::hash)(sp) == 2155);
|
||||
return detect_errors(x.hash == 17610 && sp->hash == 2155);
|
||||
}
|
||||
161
ref.html
161
ref.html
@@ -1,9 +1,162 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; URL=../../doc/html/ref.html">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>Boost: ref.hpp documentation</title>
|
||||
</head>
|
||||
<body>
|
||||
Automatic redirection failed, please go to
|
||||
<a href="../../doc/html/ref.html">../../doc/html/ref.html</a>
|
||||
|
||||
<body bgcolor="White">
|
||||
|
||||
<table border="0" width="100%">
|
||||
<tr>
|
||||
<td width="277">
|
||||
<img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86">
|
||||
</td>
|
||||
<td align="center">
|
||||
<table border="0">
|
||||
<tr><td nowrap><h1>ref.hpp</h1></td></tr>
|
||||
<tr><td align="right" nowrap><small> 1.00.0003 (2001-08-22)</small></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" height="64"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2>Files</h2>
|
||||
<ul>
|
||||
<li><a href="../../boost/ref.hpp">ref.hpp</a>
|
||||
</ul>
|
||||
|
||||
<h2>Purpose</h2>
|
||||
|
||||
<p>
|
||||
The header <a href="../../boost/ref.hpp">boost/ref.hpp</a> defines the class template
|
||||
<b>boost::reference_wrapper<T></b> and the two functions <b>boost::ref</b> and
|
||||
<b>boost::cref</b> that return instances of <b>boost::reference_wrapper<T></b>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The purpose of <b>boost::reference_wrapper<T></b> is to contain a reference to
|
||||
an object of type <b>T</b>. It is primarily used to "feed" references to
|
||||
function templates (algorithms) that take their parameter by value.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To support this usage, <b>boost::reference_wrapper<T></b> provides an implicit
|
||||
conversion to <b>T &</b>. This usually allows the function templates to
|
||||
work on references unmodified.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>boost::reference_wrapper<T></b> is <b>CopyConstructible</b>, but it is not
|
||||
<b>Assignable</b>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The expression <b>boost::ref(x)</b> returns a <b>boost::reference_wrapper<X>(x)</b>
|
||||
where <b>X</b> is the type of <b>x</b>. Similarly, <b>boost::cref(x)</b>
|
||||
returns a <b>boost::reference_wrapper<X const>(x)</b>.
|
||||
</p>
|
||||
|
||||
<h2>Interface</h2>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
|
||||
<pre>
|
||||
namespace boost
|
||||
{
|
||||
template<class T> class <a href="#reference_wrapper">reference_wrapper</a>;
|
||||
template<class T> reference_wrapper<T> <a href="#ref">ref</a>(T & t);
|
||||
template<class T> reference_wrapper<T const> <a href="#cref">cref</a>(T const & t);
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h3><a name="reference_wrapper">reference_wrapper</a></h3>
|
||||
|
||||
<pre>
|
||||
template<class T> class reference_wrapper
|
||||
{
|
||||
public:
|
||||
|
||||
explicit <a href="#rt_construct">reference_wrapper</a>(T & t);
|
||||
|
||||
<a href="#rt_operator">operator T &</a> () const;
|
||||
|
||||
T & <a href="#rt_get">get</a>() const;
|
||||
};
|
||||
</pre>
|
||||
|
||||
<h4><a name="rt_construct">explicit reference_wrapper(T & t)</a></h4>
|
||||
|
||||
<p>
|
||||
<b>Effects:</b> Constructs a <b>reference_wrapper</b> object that stores a reference to <b>t</b>.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
|
||||
<h4><a name="rt_operator">operator T & () const</a></h4>
|
||||
|
||||
<p>
|
||||
<b>Returns:</b> the stored reference.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
|
||||
<h4><a name="rt_get">T & get() const</a></h4>
|
||||
|
||||
<p>
|
||||
<b>Returns:</b> the stored reference.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
|
||||
<h3><a name="ref">ref</a></h3>
|
||||
|
||||
<pre>
|
||||
template<class T> reference_wrapper<T> ref(T & t);
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<b>Returns:</b> <tt>reference_wrapper<T>(t)</tt>.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
|
||||
<h3><a name="cref">cref</a></h3>
|
||||
|
||||
<pre>
|
||||
template<class T> reference_wrapper<T const> cref(T const & t);
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<b>Returns:</b> <tt>reference_wrapper<T const>(t)</tt>.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
|
||||
<h2>Acknowledgements</h2>
|
||||
|
||||
<p>
|
||||
<b>ref</b> and <b>cref</b> were originally part of the Boost.Tuple library.
|
||||
They were "promoted to <b>boost::</b> status" because they are generally
|
||||
useful.
|
||||
</p>
|
||||
|
||||
|
||||
<p><br><br><br><small>Copyright © 2001 by Peter Dimov and Multi Media
|
||||
Ltd. Permission to copy, use, modify, sell and distribute this document is
|
||||
granted provided this copyright notice appears in all copies. This document
|
||||
is provided "as is" without express or implied warranty, and with
|
||||
no claim as to its suitability for any purpose.</small></p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
25
test/Jamfile
25
test/Jamfile
@@ -1,25 +0,0 @@
|
||||
# Boost.Bind Library test Jamfile
|
||||
#
|
||||
# Copyright (c) 2003 Peter Dimov
|
||||
#
|
||||
# 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.
|
||||
|
||||
subproject libs/bind/test ;
|
||||
|
||||
# bring in rules for testing
|
||||
import testing ;
|
||||
|
||||
# Make tests run by default.
|
||||
DEPENDS all : bind ;
|
||||
|
||||
{
|
||||
test-suite "bind"
|
||||
: [ run bind_test.cpp ]
|
||||
[ run mem_fn_test.cpp ]
|
||||
[ run mem_fn_void_test.cpp ]
|
||||
[ run mem_fn_derived_test.cpp ]
|
||||
;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
# Boost.Bind Library test Jamfile
|
||||
#
|
||||
# Copyright (c) 2003 Peter Dimov
|
||||
#
|
||||
# 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.
|
||||
|
||||
# bring in rules for testing
|
||||
import testing ;
|
||||
|
||||
test-suite "bind"
|
||||
: [ run bind_test.cpp ]
|
||||
[ run mem_fn_test.cpp ]
|
||||
[ run mem_fn_void_test.cpp ]
|
||||
[ run mem_fn_derived_test.cpp ]
|
||||
;
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4514) // unreferenced inline removed
|
||||
#endif
|
||||
|
||||
//
|
||||
// bind_fastcall_test.cpp - test for bind.hpp + __fastcall (free functions)
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#define BOOST_BIND_ENABLE_FASTCALL
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
//
|
||||
|
||||
long __fastcall f_0()
|
||||
{
|
||||
return 17041L;
|
||||
}
|
||||
|
||||
long __fastcall f_1(long a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
long __fastcall f_2(long a, long b)
|
||||
{
|
||||
return a + 10 * b;
|
||||
}
|
||||
|
||||
long __fastcall f_3(long a, long b, long c)
|
||||
{
|
||||
return a + 10 * b + 100 * c;
|
||||
}
|
||||
|
||||
long __fastcall f_4(long a, long b, long c, long d)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d;
|
||||
}
|
||||
|
||||
long __fastcall f_5(long a, long b, long c, long d, long e)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e;
|
||||
}
|
||||
|
||||
long __fastcall f_6(long a, long b, long c, long d, long e, long f)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
|
||||
}
|
||||
|
||||
long __fastcall f_7(long a, long b, long c, long d, long e, long f, long g)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
|
||||
}
|
||||
|
||||
long __fastcall f_8(long a, long b, long c, long d, long e, long f, long g, long h)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
|
||||
}
|
||||
|
||||
long __fastcall f_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
|
||||
}
|
||||
|
||||
void function_test()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
int const i = 1;
|
||||
|
||||
BOOST_TEST( bind(f_0)(i) == 17041L );
|
||||
BOOST_TEST( bind(f_1, _1)(i) == 1L );
|
||||
BOOST_TEST( bind(f_2, _1, 2)(i) == 21L );
|
||||
BOOST_TEST( bind(f_3, _1, 2, 3)(i) == 321L );
|
||||
BOOST_TEST( bind(f_4, _1, 2, 3, 4)(i) == 4321L );
|
||||
BOOST_TEST( bind(f_5, _1, 2, 3, 4, 5)(i) == 54321L );
|
||||
BOOST_TEST( bind(f_6, _1, 2, 3, 4, 5, 6)(i) == 654321L );
|
||||
BOOST_TEST( bind(f_7, _1, 2, 3, 4, 5, 6, 7)(i) == 7654321L );
|
||||
BOOST_TEST( bind(f_8, _1, 2, 3, 4, 5, 6, 7, 8)(i) == 87654321L );
|
||||
BOOST_TEST( bind(f_9, _1, 2, 3, 4, 5, 6, 7, 8, 9)(i) == 987654321L );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
function_test();
|
||||
return boost::report_errors();
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4514) // unreferenced inline removed
|
||||
#endif
|
||||
|
||||
//
|
||||
// bind_stdcall_mf_test.cpp - test for bind.hpp + __stdcall (member functions)
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#define BOOST_MEM_FN_ENABLE_STDCALL
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
struct X
|
||||
{
|
||||
mutable unsigned int hash;
|
||||
|
||||
X(): hash(0) {}
|
||||
|
||||
int __stdcall f0() { f1(17); return 0; }
|
||||
int __stdcall g0() const { g1(17); return 0; }
|
||||
|
||||
int __stdcall f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
|
||||
int __stdcall g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
|
||||
|
||||
int __stdcall f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
|
||||
int __stdcall g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
|
||||
|
||||
int __stdcall f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
|
||||
int __stdcall g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
|
||||
|
||||
int __stdcall f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
|
||||
int __stdcall g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
|
||||
|
||||
int __stdcall f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
|
||||
int __stdcall g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
|
||||
|
||||
int __stdcall f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
|
||||
int __stdcall g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
|
||||
|
||||
int __stdcall f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
|
||||
int __stdcall g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
|
||||
|
||||
int __stdcall f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
|
||||
int __stdcall g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
|
||||
};
|
||||
|
||||
void member_function_test()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
X x;
|
||||
|
||||
// 0
|
||||
|
||||
bind(&X::f0, &x)();
|
||||
bind(&X::f0, ref(x))();
|
||||
|
||||
bind(&X::g0, &x)();
|
||||
bind(&X::g0, x)();
|
||||
bind(&X::g0, ref(x))();
|
||||
|
||||
// 1
|
||||
|
||||
bind(&X::f1, &x, 1)();
|
||||
bind(&X::f1, ref(x), 1)();
|
||||
|
||||
bind(&X::g1, &x, 1)();
|
||||
bind(&X::g1, x, 1)();
|
||||
bind(&X::g1, ref(x), 1)();
|
||||
|
||||
// 2
|
||||
|
||||
bind(&X::f2, &x, 1, 2)();
|
||||
bind(&X::f2, ref(x), 1, 2)();
|
||||
|
||||
bind(&X::g2, &x, 1, 2)();
|
||||
bind(&X::g2, x, 1, 2)();
|
||||
bind(&X::g2, ref(x), 1, 2)();
|
||||
|
||||
// 3
|
||||
|
||||
bind(&X::f3, &x, 1, 2, 3)();
|
||||
bind(&X::f3, ref(x), 1, 2, 3)();
|
||||
|
||||
bind(&X::g3, &x, 1, 2, 3)();
|
||||
bind(&X::g3, x, 1, 2, 3)();
|
||||
bind(&X::g3, ref(x), 1, 2, 3)();
|
||||
|
||||
// 4
|
||||
|
||||
bind(&X::f4, &x, 1, 2, 3, 4)();
|
||||
bind(&X::f4, ref(x), 1, 2, 3, 4)();
|
||||
|
||||
bind(&X::g4, &x, 1, 2, 3, 4)();
|
||||
bind(&X::g4, x, 1, 2, 3, 4)();
|
||||
bind(&X::g4, ref(x), 1, 2, 3, 4)();
|
||||
|
||||
// 5
|
||||
|
||||
bind(&X::f5, &x, 1, 2, 3, 4, 5)();
|
||||
bind(&X::f5, ref(x), 1, 2, 3, 4, 5)();
|
||||
|
||||
bind(&X::g5, &x, 1, 2, 3, 4, 5)();
|
||||
bind(&X::g5, x, 1, 2, 3, 4, 5)();
|
||||
bind(&X::g5, ref(x), 1, 2, 3, 4, 5)();
|
||||
|
||||
// 6
|
||||
|
||||
bind(&X::f6, &x, 1, 2, 3, 4, 5, 6)();
|
||||
bind(&X::f6, ref(x), 1, 2, 3, 4, 5, 6)();
|
||||
|
||||
bind(&X::g6, &x, 1, 2, 3, 4, 5, 6)();
|
||||
bind(&X::g6, x, 1, 2, 3, 4, 5, 6)();
|
||||
bind(&X::g6, ref(x), 1, 2, 3, 4, 5, 6)();
|
||||
|
||||
// 7
|
||||
|
||||
bind(&X::f7, &x, 1, 2, 3, 4, 5, 6, 7)();
|
||||
bind(&X::f7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
|
||||
|
||||
bind(&X::g7, &x, 1, 2, 3, 4, 5, 6, 7)();
|
||||
bind(&X::g7, x, 1, 2, 3, 4, 5, 6, 7)();
|
||||
bind(&X::g7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
|
||||
|
||||
// 8
|
||||
|
||||
bind(&X::f8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
bind(&X::f8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
|
||||
bind(&X::g8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
bind(&X::g8, x, 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
bind(&X::g8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
|
||||
BOOST_TEST( x.hash == 23558 );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
member_function_test();
|
||||
return boost::report_errors();
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4514) // unreferenced inline removed
|
||||
#endif
|
||||
|
||||
//
|
||||
// bind_stdcall_test.cpp - test for bind.hpp + __stdcall (free functions)
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#define BOOST_BIND_ENABLE_STDCALL
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
//
|
||||
|
||||
long __stdcall f_0()
|
||||
{
|
||||
return 17041L;
|
||||
}
|
||||
|
||||
long __stdcall f_1(long a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
long __stdcall f_2(long a, long b)
|
||||
{
|
||||
return a + 10 * b;
|
||||
}
|
||||
|
||||
long __stdcall f_3(long a, long b, long c)
|
||||
{
|
||||
return a + 10 * b + 100 * c;
|
||||
}
|
||||
|
||||
long __stdcall f_4(long a, long b, long c, long d)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d;
|
||||
}
|
||||
|
||||
long __stdcall f_5(long a, long b, long c, long d, long e)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e;
|
||||
}
|
||||
|
||||
long __stdcall f_6(long a, long b, long c, long d, long e, long f)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
|
||||
}
|
||||
|
||||
long __stdcall f_7(long a, long b, long c, long d, long e, long f, long g)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
|
||||
}
|
||||
|
||||
long __stdcall f_8(long a, long b, long c, long d, long e, long f, long g, long h)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
|
||||
}
|
||||
|
||||
long __stdcall f_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
|
||||
}
|
||||
|
||||
void function_test()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
int const i = 1;
|
||||
|
||||
BOOST_TEST( bind(f_0)(i) == 17041L );
|
||||
BOOST_TEST( bind(f_1, _1)(i) == 1L );
|
||||
BOOST_TEST( bind(f_2, _1, 2)(i) == 21L );
|
||||
BOOST_TEST( bind(f_3, _1, 2, 3)(i) == 321L );
|
||||
BOOST_TEST( bind(f_4, _1, 2, 3, 4)(i) == 4321L );
|
||||
BOOST_TEST( bind(f_5, _1, 2, 3, 4, 5)(i) == 54321L );
|
||||
BOOST_TEST( bind(f_6, _1, 2, 3, 4, 5, 6)(i) == 654321L );
|
||||
BOOST_TEST( bind(f_7, _1, 2, 3, 4, 5, 6, 7)(i) == 7654321L );
|
||||
BOOST_TEST( bind(f_8, _1, 2, 3, 4, 5, 6, 7, 8)(i) == 87654321L );
|
||||
BOOST_TEST( bind(f_9, _1, 2, 3, 4, 5, 6, 7, 8, 9)(i) == 987654321L );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
function_test();
|
||||
return boost::report_errors();
|
||||
}
|
||||
@@ -1,522 +0,0 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4514) // unreferenced inline removed
|
||||
#endif
|
||||
|
||||
//
|
||||
// bind_test.cpp - monolithic test for bind.hpp
|
||||
//
|
||||
// Copyright (c) 2001, 2002 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.
|
||||
//
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
//
|
||||
|
||||
long f_0()
|
||||
{
|
||||
return 17041L;
|
||||
}
|
||||
|
||||
long f_1(long a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
long f_2(long a, long b)
|
||||
{
|
||||
return a + 10 * b;
|
||||
}
|
||||
|
||||
long f_3(long a, long b, long c)
|
||||
{
|
||||
return a + 10 * b + 100 * c;
|
||||
}
|
||||
|
||||
long f_4(long a, long b, long c, long d)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d;
|
||||
}
|
||||
|
||||
long f_5(long a, long b, long c, long d, long e)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e;
|
||||
}
|
||||
|
||||
long f_6(long a, long b, long c, long d, long e, long f)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
|
||||
}
|
||||
|
||||
long f_7(long a, long b, long c, long d, long e, long f, long g)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
|
||||
}
|
||||
|
||||
long f_8(long a, long b, long c, long d, long e, long f, long g, long h)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
|
||||
}
|
||||
|
||||
long f_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
|
||||
{
|
||||
return a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
|
||||
}
|
||||
|
||||
long global_result;
|
||||
|
||||
void fv_0()
|
||||
{
|
||||
global_result = 17041L;
|
||||
}
|
||||
|
||||
void fv_1(long a)
|
||||
{
|
||||
global_result = a;
|
||||
}
|
||||
|
||||
void fv_2(long a, long b)
|
||||
{
|
||||
global_result = a + 10 * b;
|
||||
}
|
||||
|
||||
void fv_3(long a, long b, long c)
|
||||
{
|
||||
global_result = a + 10 * b + 100 * c;
|
||||
}
|
||||
|
||||
void fv_4(long a, long b, long c, long d)
|
||||
{
|
||||
global_result = a + 10 * b + 100 * c + 1000 * d;
|
||||
}
|
||||
|
||||
void fv_5(long a, long b, long c, long d, long e)
|
||||
{
|
||||
global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e;
|
||||
}
|
||||
|
||||
void fv_6(long a, long b, long c, long d, long e, long f)
|
||||
{
|
||||
global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f;
|
||||
}
|
||||
|
||||
void fv_7(long a, long b, long c, long d, long e, long f, long g)
|
||||
{
|
||||
global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g;
|
||||
}
|
||||
|
||||
void fv_8(long a, long b, long c, long d, long e, long f, long g, long h)
|
||||
{
|
||||
global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h;
|
||||
}
|
||||
|
||||
void fv_9(long a, long b, long c, long d, long e, long f, long g, long h, long i)
|
||||
{
|
||||
global_result = a + 10 * b + 100 * c + 1000 * d + 10000 * e + 100000 * f + 1000000 * g + 10000000 * h + 100000000 * i;
|
||||
}
|
||||
|
||||
void function_test()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
int const i = 1;
|
||||
|
||||
BOOST_TEST( bind(f_0)(i) == 17041L );
|
||||
BOOST_TEST( bind(f_1, _1)(i) == 1L );
|
||||
BOOST_TEST( bind(f_2, _1, 2)(i) == 21L );
|
||||
BOOST_TEST( bind(f_3, _1, 2, 3)(i) == 321L );
|
||||
BOOST_TEST( bind(f_4, _1, 2, 3, 4)(i) == 4321L );
|
||||
BOOST_TEST( bind(f_5, _1, 2, 3, 4, 5)(i) == 54321L );
|
||||
BOOST_TEST( bind(f_6, _1, 2, 3, 4, 5, 6)(i) == 654321L );
|
||||
BOOST_TEST( bind(f_7, _1, 2, 3, 4, 5, 6, 7)(i) == 7654321L );
|
||||
BOOST_TEST( bind(f_8, _1, 2, 3, 4, 5, 6, 7, 8)(i) == 87654321L );
|
||||
BOOST_TEST( bind(f_9, _1, 2, 3, 4, 5, 6, 7, 8, 9)(i) == 987654321L );
|
||||
|
||||
BOOST_TEST( (bind(fv_0)(i), (global_result == 17041L)) );
|
||||
BOOST_TEST( (bind(fv_1, _1)(i), (global_result == 1L)) );
|
||||
BOOST_TEST( (bind(fv_2, _1, 2)(i), (global_result == 21L)) );
|
||||
BOOST_TEST( (bind(fv_3, _1, 2, 3)(i), (global_result == 321L)) );
|
||||
BOOST_TEST( (bind(fv_4, _1, 2, 3, 4)(i), (global_result == 4321L)) );
|
||||
BOOST_TEST( (bind(fv_5, _1, 2, 3, 4, 5)(i), (global_result == 54321L)) );
|
||||
BOOST_TEST( (bind(fv_6, _1, 2, 3, 4, 5, 6)(i), (global_result == 654321L)) );
|
||||
BOOST_TEST( (bind(fv_7, _1, 2, 3, 4, 5, 6, 7)(i), (global_result == 7654321L)) );
|
||||
BOOST_TEST( (bind(fv_8, _1, 2, 3, 4, 5, 6, 7, 8)(i), (global_result == 87654321L)) );
|
||||
BOOST_TEST( (bind(fv_9, _1, 2, 3, 4, 5, 6, 7, 8, 9)(i), (global_result == 987654321L)) );
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
struct Y
|
||||
{
|
||||
short operator()(short & r) const { return ++r; }
|
||||
int operator()(int a, int b) const { return a + 10 * b; }
|
||||
long operator() (long a, long b, long c) const { return a + 10 * b + 100 * c; }
|
||||
void operator() (long a, long b, long c, long d) const { global_result = a + 10 * b + 100 * c + 1000 * d; }
|
||||
};
|
||||
|
||||
void function_object_test()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
short i(6);
|
||||
|
||||
int const k = 3;
|
||||
|
||||
BOOST_TEST( bind<short>(Y(), ref(i))() == 7 );
|
||||
BOOST_TEST( bind<short>(Y(), ref(i))() == 8 );
|
||||
BOOST_TEST( bind<int>(Y(), i, _1)(k) == 38 );
|
||||
BOOST_TEST( bind<long>(Y(), i, _1, 9)(k) == 938 );
|
||||
|
||||
#if !defined(__MWERKS__) || (__MWERKS__ > 0x2406) // Fails for this version of the compiler.
|
||||
|
||||
global_result = 0;
|
||||
bind<void>(Y(), i, _1, 9, 4)(k);
|
||||
BOOST_TEST( global_result == 4938 );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void function_object_test2()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
short i(6);
|
||||
|
||||
int const k = 3;
|
||||
|
||||
BOOST_TEST( bind(type<short>(), Y(), ref(i))() == 7 );
|
||||
BOOST_TEST( bind(type<short>(), Y(), ref(i))() == 8 );
|
||||
BOOST_TEST( bind(type<int>(), Y(), i, _1)(k) == 38 );
|
||||
BOOST_TEST( bind(type<long>(), Y(), i, _1, 9)(k) == 938 );
|
||||
|
||||
global_result = 0;
|
||||
bind(type<void>(), Y(), i, _1, 9, 4)(k);
|
||||
BOOST_TEST( global_result == 4938 );
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
|
||||
struct Z
|
||||
{
|
||||
typedef int result_type;
|
||||
int operator()(int a, int b) const { return a + 10 * b; }
|
||||
};
|
||||
|
||||
void adaptable_function_object_test()
|
||||
{
|
||||
BOOST_TEST( boost::bind(Z(), 7, 4)() == 47 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
|
||||
struct X
|
||||
{
|
||||
mutable unsigned int hash;
|
||||
|
||||
X(): hash(0) {}
|
||||
|
||||
int f0() { f1(17); return 0; }
|
||||
int g0() const { g1(17); return 0; }
|
||||
|
||||
int f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
|
||||
int g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
|
||||
|
||||
int f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
|
||||
int g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
|
||||
|
||||
int f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
|
||||
int g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
|
||||
|
||||
int f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
|
||||
int g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
|
||||
|
||||
int f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
|
||||
int g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
|
||||
|
||||
int f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
|
||||
int g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
|
||||
|
||||
int f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
|
||||
int g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
|
||||
|
||||
int f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
|
||||
int g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
|
||||
};
|
||||
|
||||
struct V
|
||||
{
|
||||
mutable unsigned int hash;
|
||||
|
||||
V(): hash(0) {}
|
||||
|
||||
void f0() { f1(17); }
|
||||
void g0() const { g1(17); }
|
||||
|
||||
void f1(int a1) { hash = (hash * 17041 + a1) % 32768; }
|
||||
void g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; }
|
||||
|
||||
void f2(int a1, int a2) { f1(a1); f1(a2); }
|
||||
void g2(int a1, int a2) const { g1(a1); g1(a2); }
|
||||
|
||||
void f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); }
|
||||
void g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); }
|
||||
|
||||
void f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); }
|
||||
void g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); }
|
||||
|
||||
void f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); }
|
||||
void g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); }
|
||||
|
||||
void f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); }
|
||||
void g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); }
|
||||
|
||||
void f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); }
|
||||
void g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); }
|
||||
|
||||
void f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); }
|
||||
void g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); }
|
||||
};
|
||||
|
||||
void member_function_test()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
X x;
|
||||
|
||||
// 0
|
||||
|
||||
bind(&X::f0, &x)();
|
||||
bind(&X::f0, ref(x))();
|
||||
|
||||
bind(&X::g0, &x)();
|
||||
bind(&X::g0, x)();
|
||||
bind(&X::g0, ref(x))();
|
||||
|
||||
// 1
|
||||
|
||||
bind(&X::f1, &x, 1)();
|
||||
bind(&X::f1, ref(x), 1)();
|
||||
|
||||
bind(&X::g1, &x, 1)();
|
||||
bind(&X::g1, x, 1)();
|
||||
bind(&X::g1, ref(x), 1)();
|
||||
|
||||
// 2
|
||||
|
||||
bind(&X::f2, &x, 1, 2)();
|
||||
bind(&X::f2, ref(x), 1, 2)();
|
||||
|
||||
bind(&X::g2, &x, 1, 2)();
|
||||
bind(&X::g2, x, 1, 2)();
|
||||
bind(&X::g2, ref(x), 1, 2)();
|
||||
|
||||
// 3
|
||||
|
||||
bind(&X::f3, &x, 1, 2, 3)();
|
||||
bind(&X::f3, ref(x), 1, 2, 3)();
|
||||
|
||||
bind(&X::g3, &x, 1, 2, 3)();
|
||||
bind(&X::g3, x, 1, 2, 3)();
|
||||
bind(&X::g3, ref(x), 1, 2, 3)();
|
||||
|
||||
// 4
|
||||
|
||||
bind(&X::f4, &x, 1, 2, 3, 4)();
|
||||
bind(&X::f4, ref(x), 1, 2, 3, 4)();
|
||||
|
||||
bind(&X::g4, &x, 1, 2, 3, 4)();
|
||||
bind(&X::g4, x, 1, 2, 3, 4)();
|
||||
bind(&X::g4, ref(x), 1, 2, 3, 4)();
|
||||
|
||||
// 5
|
||||
|
||||
bind(&X::f5, &x, 1, 2, 3, 4, 5)();
|
||||
bind(&X::f5, ref(x), 1, 2, 3, 4, 5)();
|
||||
|
||||
bind(&X::g5, &x, 1, 2, 3, 4, 5)();
|
||||
bind(&X::g5, x, 1, 2, 3, 4, 5)();
|
||||
bind(&X::g5, ref(x), 1, 2, 3, 4, 5)();
|
||||
|
||||
// 6
|
||||
|
||||
bind(&X::f6, &x, 1, 2, 3, 4, 5, 6)();
|
||||
bind(&X::f6, ref(x), 1, 2, 3, 4, 5, 6)();
|
||||
|
||||
bind(&X::g6, &x, 1, 2, 3, 4, 5, 6)();
|
||||
bind(&X::g6, x, 1, 2, 3, 4, 5, 6)();
|
||||
bind(&X::g6, ref(x), 1, 2, 3, 4, 5, 6)();
|
||||
|
||||
// 7
|
||||
|
||||
bind(&X::f7, &x, 1, 2, 3, 4, 5, 6, 7)();
|
||||
bind(&X::f7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
|
||||
|
||||
bind(&X::g7, &x, 1, 2, 3, 4, 5, 6, 7)();
|
||||
bind(&X::g7, x, 1, 2, 3, 4, 5, 6, 7)();
|
||||
bind(&X::g7, ref(x), 1, 2, 3, 4, 5, 6, 7)();
|
||||
|
||||
// 8
|
||||
|
||||
bind(&X::f8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
bind(&X::f8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
|
||||
bind(&X::g8, &x, 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
bind(&X::g8, x, 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
bind(&X::g8, ref(x), 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
|
||||
BOOST_TEST( bind(&X::hash, _1)(x) == 23558 );
|
||||
}
|
||||
|
||||
void member_function_void_test()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
V v;
|
||||
|
||||
// 0
|
||||
|
||||
bind(&V::f0, &v)();
|
||||
bind(&V::f0, ref(v))();
|
||||
|
||||
bind(&V::g0, &v)();
|
||||
bind(&V::g0, v)();
|
||||
bind(&V::g0, ref(v))();
|
||||
|
||||
// 1
|
||||
|
||||
bind(&V::f1, &v, 1)();
|
||||
bind(&V::f1, ref(v), 1)();
|
||||
|
||||
bind(&V::g1, &v, 1)();
|
||||
bind(&V::g1, v, 1)();
|
||||
bind(&V::g1, ref(v), 1)();
|
||||
|
||||
// 2
|
||||
|
||||
bind(&V::f2, &v, 1, 2)();
|
||||
bind(&V::f2, ref(v), 1, 2)();
|
||||
|
||||
bind(&V::g2, &v, 1, 2)();
|
||||
bind(&V::g2, v, 1, 2)();
|
||||
bind(&V::g2, ref(v), 1, 2)();
|
||||
|
||||
// 3
|
||||
|
||||
bind(&V::f3, &v, 1, 2, 3)();
|
||||
bind(&V::f3, ref(v), 1, 2, 3)();
|
||||
|
||||
bind(&V::g3, &v, 1, 2, 3)();
|
||||
bind(&V::g3, v, 1, 2, 3)();
|
||||
bind(&V::g3, ref(v), 1, 2, 3)();
|
||||
|
||||
// 4
|
||||
|
||||
bind(&V::f4, &v, 1, 2, 3, 4)();
|
||||
bind(&V::f4, ref(v), 1, 2, 3, 4)();
|
||||
|
||||
bind(&V::g4, &v, 1, 2, 3, 4)();
|
||||
bind(&V::g4, v, 1, 2, 3, 4)();
|
||||
bind(&V::g4, ref(v), 1, 2, 3, 4)();
|
||||
|
||||
// 5
|
||||
|
||||
bind(&V::f5, &v, 1, 2, 3, 4, 5)();
|
||||
bind(&V::f5, ref(v), 1, 2, 3, 4, 5)();
|
||||
|
||||
bind(&V::g5, &v, 1, 2, 3, 4, 5)();
|
||||
bind(&V::g5, v, 1, 2, 3, 4, 5)();
|
||||
bind(&V::g5, ref(v), 1, 2, 3, 4, 5)();
|
||||
|
||||
// 6
|
||||
|
||||
bind(&V::f6, &v, 1, 2, 3, 4, 5, 6)();
|
||||
bind(&V::f6, ref(v), 1, 2, 3, 4, 5, 6)();
|
||||
|
||||
bind(&V::g6, &v, 1, 2, 3, 4, 5, 6)();
|
||||
bind(&V::g6, v, 1, 2, 3, 4, 5, 6)();
|
||||
bind(&V::g6, ref(v), 1, 2, 3, 4, 5, 6)();
|
||||
|
||||
// 7
|
||||
|
||||
bind(&V::f7, &v, 1, 2, 3, 4, 5, 6, 7)();
|
||||
bind(&V::f7, ref(v), 1, 2, 3, 4, 5, 6, 7)();
|
||||
|
||||
bind(&V::g7, &v, 1, 2, 3, 4, 5, 6, 7)();
|
||||
bind(&V::g7, v, 1, 2, 3, 4, 5, 6, 7)();
|
||||
bind(&V::g7, ref(v), 1, 2, 3, 4, 5, 6, 7)();
|
||||
|
||||
// 8
|
||||
|
||||
bind(&V::f8, &v, 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
bind(&V::f8, ref(v), 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
|
||||
bind(&V::g8, &v, 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
bind(&V::g8, v, 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
bind(&V::g8, ref(v), 1, 2, 3, 4, 5, 6, 7, 8)();
|
||||
|
||||
BOOST_TEST( bind(&V::hash, _1)(v) == 23558 );
|
||||
}
|
||||
|
||||
void nested_bind_test()
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
int const x = 1;
|
||||
int const y = 2;
|
||||
|
||||
BOOST_TEST( bind(f_1, bind(f_1, _1))(x) == 1L );
|
||||
BOOST_TEST( bind(f_1, bind(f_2, _1, _2))(x, y) == 21L );
|
||||
BOOST_TEST( bind(f_2, bind(f_1, _1), bind(f_1, _1))(x) == 11L );
|
||||
BOOST_TEST( bind(f_2, bind(f_1, _1), bind(f_1, _2))(x, y) == 21L );
|
||||
BOOST_TEST( bind(f_1, bind(f_0))() == 17041L );
|
||||
|
||||
BOOST_TEST( (bind(fv_1, bind(f_1, _1))(x), (global_result == 1L)) );
|
||||
BOOST_TEST( (bind(fv_1, bind(f_2, _1, _2))(x, y), (global_result == 21L)) );
|
||||
BOOST_TEST( (bind(fv_2, bind(f_1, _1), bind(f_1, _1))(x), (global_result == 11L)) );
|
||||
BOOST_TEST( (bind(fv_2, bind(f_1, _1), bind(f_1, _2))(x, y), (global_result == 21L)) );
|
||||
BOOST_TEST( (bind(fv_1, bind(f_0))(), (global_result == 17041L)) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
function_test();
|
||||
function_object_test();
|
||||
function_object_test2();
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
adaptable_function_object_test();
|
||||
#endif
|
||||
|
||||
member_function_test();
|
||||
member_function_void_test();
|
||||
nested_bind_test();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4514) // unreferenced inline removed
|
||||
#endif
|
||||
|
||||
//
|
||||
// mem_fn_derived_test.cpp - tests mem_fn.hpp with derived objects
|
||||
//
|
||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#include <boost/mem_fn.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
struct B
|
||||
{
|
||||
mutable unsigned int hash;
|
||||
|
||||
B(): hash(0) {}
|
||||
|
||||
int f0() { f1(17); return 0; }
|
||||
int g0() const { g1(17); return 0; }
|
||||
|
||||
int f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
|
||||
int g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
|
||||
|
||||
int f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
|
||||
int g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
|
||||
|
||||
int f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
|
||||
int g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
|
||||
|
||||
int f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
|
||||
int g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
|
||||
|
||||
int f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
|
||||
int g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
|
||||
|
||||
int f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
|
||||
int g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
|
||||
|
||||
int f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
|
||||
int g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
|
||||
|
||||
int f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
|
||||
int g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
|
||||
};
|
||||
|
||||
struct X: public B
|
||||
{
|
||||
};
|
||||
|
||||
int detect_errors(bool x)
|
||||
{
|
||||
if(x)
|
||||
{
|
||||
std::cerr << "no errors detected.\n";
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "test failed.\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
using boost::mem_fn;
|
||||
|
||||
X x;
|
||||
|
||||
X const & rcx = x;
|
||||
X const * pcx = &x;
|
||||
|
||||
boost::shared_ptr<X> sp(new X);
|
||||
|
||||
mem_fn(&X::f0)(x);
|
||||
mem_fn(&X::f0)(&x);
|
||||
mem_fn(&X::f0)(sp);
|
||||
|
||||
mem_fn(&X::g0)(x);
|
||||
mem_fn(&X::g0)(rcx);
|
||||
mem_fn(&X::g0)(&x);
|
||||
mem_fn(&X::g0)(pcx);
|
||||
mem_fn(&X::g0)(sp);
|
||||
|
||||
mem_fn(&X::f1)(x, 1);
|
||||
mem_fn(&X::f1)(&x, 1);
|
||||
mem_fn(&X::f1)(sp, 1);
|
||||
|
||||
mem_fn(&X::g1)(x, 1);
|
||||
mem_fn(&X::g1)(rcx, 1);
|
||||
mem_fn(&X::g1)(&x, 1);
|
||||
mem_fn(&X::g1)(pcx, 1);
|
||||
mem_fn(&X::g1)(sp, 1);
|
||||
|
||||
mem_fn(&X::f2)(x, 1, 2);
|
||||
mem_fn(&X::f2)(&x, 1, 2);
|
||||
mem_fn(&X::f2)(sp, 1, 2);
|
||||
|
||||
mem_fn(&X::g2)(x, 1, 2);
|
||||
mem_fn(&X::g2)(rcx, 1, 2);
|
||||
mem_fn(&X::g2)(&x, 1, 2);
|
||||
mem_fn(&X::g2)(pcx, 1, 2);
|
||||
mem_fn(&X::g2)(sp, 1, 2);
|
||||
|
||||
mem_fn(&X::f3)(x, 1, 2, 3);
|
||||
mem_fn(&X::f3)(&x, 1, 2, 3);
|
||||
mem_fn(&X::f3)(sp, 1, 2, 3);
|
||||
|
||||
mem_fn(&X::g3)(x, 1, 2, 3);
|
||||
mem_fn(&X::g3)(rcx, 1, 2, 3);
|
||||
mem_fn(&X::g3)(&x, 1, 2, 3);
|
||||
mem_fn(&X::g3)(pcx, 1, 2, 3);
|
||||
mem_fn(&X::g3)(sp, 1, 2, 3);
|
||||
|
||||
mem_fn(&X::f4)(x, 1, 2, 3, 4);
|
||||
mem_fn(&X::f4)(&x, 1, 2, 3, 4);
|
||||
mem_fn(&X::f4)(sp, 1, 2, 3, 4);
|
||||
|
||||
mem_fn(&X::g4)(x, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(rcx, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(&x, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(pcx, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(sp, 1, 2, 3, 4);
|
||||
|
||||
mem_fn(&X::f5)(x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::f5)(&x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::f5)(sp, 1, 2, 3, 4, 5);
|
||||
|
||||
mem_fn(&X::g5)(x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(rcx, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(&x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(pcx, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(sp, 1, 2, 3, 4, 5);
|
||||
|
||||
mem_fn(&X::f6)(x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::f6)(&x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::f6)(sp, 1, 2, 3, 4, 5, 6);
|
||||
|
||||
mem_fn(&X::g6)(x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(rcx, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(&x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(pcx, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(sp, 1, 2, 3, 4, 5, 6);
|
||||
|
||||
mem_fn(&X::f7)(x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::f7)(&x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::f7)(sp, 1, 2, 3, 4, 5, 6, 7);
|
||||
|
||||
mem_fn(&X::g7)(x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(rcx, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(&x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(pcx, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(sp, 1, 2, 3, 4, 5, 6, 7);
|
||||
|
||||
mem_fn(&X::f8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::f8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::f8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
mem_fn(&X::g8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(rcx, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(pcx, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
return detect_errors(mem_fn(&X::hash)(x) == 17610 && mem_fn(&X::hash)(sp) == 2155);
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4514) // unreferenced inline removed
|
||||
#endif
|
||||
|
||||
//
|
||||
// mem_fn_fastcall_test.cpp - a test for mem_fn.hpp + __fastcall
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#define BOOST_MEM_FN_ENABLE_FASTCALL
|
||||
|
||||
#include <boost/mem_fn.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
struct X
|
||||
{
|
||||
mutable unsigned int hash;
|
||||
|
||||
X(): hash(0) {}
|
||||
|
||||
void __fastcall f0() { f1(17); }
|
||||
void __fastcall g0() const { g1(17); }
|
||||
|
||||
void __fastcall f1(int a1) { hash = (hash * 17041 + a1) % 32768; }
|
||||
void __fastcall g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; }
|
||||
|
||||
void __fastcall f2(int a1, int a2) { f1(a1); f1(a2); }
|
||||
void __fastcall g2(int a1, int a2) const { g1(a1); g1(a2); }
|
||||
|
||||
void __fastcall f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); }
|
||||
void __fastcall g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); }
|
||||
|
||||
void __fastcall f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); }
|
||||
void __fastcall g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); }
|
||||
|
||||
void __fastcall f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); }
|
||||
void __fastcall g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); }
|
||||
|
||||
void __fastcall f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); }
|
||||
void __fastcall g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); }
|
||||
|
||||
void __fastcall f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); }
|
||||
void __fastcall g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); }
|
||||
|
||||
void __fastcall f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); }
|
||||
void __fastcall g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); }
|
||||
};
|
||||
|
||||
int detect_errors(bool x)
|
||||
{
|
||||
if(x)
|
||||
{
|
||||
std::cerr << "no errors detected.\n";
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "test failed.\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
using boost::mem_fn;
|
||||
|
||||
X x;
|
||||
|
||||
X const & rcx = x;
|
||||
X const * pcx = &x;
|
||||
|
||||
boost::shared_ptr<X> sp(new X);
|
||||
|
||||
mem_fn(&X::f0)(x);
|
||||
mem_fn(&X::f0)(&x);
|
||||
mem_fn(&X::f0)(sp);
|
||||
|
||||
mem_fn(&X::g0)(x);
|
||||
mem_fn(&X::g0)(rcx);
|
||||
mem_fn(&X::g0)(&x);
|
||||
mem_fn(&X::g0)(pcx);
|
||||
mem_fn(&X::g0)(sp);
|
||||
|
||||
mem_fn(&X::f1)(x, 1);
|
||||
mem_fn(&X::f1)(&x, 1);
|
||||
mem_fn(&X::f1)(sp, 1);
|
||||
|
||||
mem_fn(&X::g1)(x, 1);
|
||||
mem_fn(&X::g1)(rcx, 1);
|
||||
mem_fn(&X::g1)(&x, 1);
|
||||
mem_fn(&X::g1)(pcx, 1);
|
||||
mem_fn(&X::g1)(sp, 1);
|
||||
|
||||
mem_fn(&X::f2)(x, 1, 2);
|
||||
mem_fn(&X::f2)(&x, 1, 2);
|
||||
mem_fn(&X::f2)(sp, 1, 2);
|
||||
|
||||
mem_fn(&X::g2)(x, 1, 2);
|
||||
mem_fn(&X::g2)(rcx, 1, 2);
|
||||
mem_fn(&X::g2)(&x, 1, 2);
|
||||
mem_fn(&X::g2)(pcx, 1, 2);
|
||||
mem_fn(&X::g2)(sp, 1, 2);
|
||||
|
||||
mem_fn(&X::f3)(x, 1, 2, 3);
|
||||
mem_fn(&X::f3)(&x, 1, 2, 3);
|
||||
mem_fn(&X::f3)(sp, 1, 2, 3);
|
||||
|
||||
mem_fn(&X::g3)(x, 1, 2, 3);
|
||||
mem_fn(&X::g3)(rcx, 1, 2, 3);
|
||||
mem_fn(&X::g3)(&x, 1, 2, 3);
|
||||
mem_fn(&X::g3)(pcx, 1, 2, 3);
|
||||
mem_fn(&X::g3)(sp, 1, 2, 3);
|
||||
|
||||
mem_fn(&X::f4)(x, 1, 2, 3, 4);
|
||||
mem_fn(&X::f4)(&x, 1, 2, 3, 4);
|
||||
mem_fn(&X::f4)(sp, 1, 2, 3, 4);
|
||||
|
||||
mem_fn(&X::g4)(x, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(rcx, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(&x, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(pcx, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(sp, 1, 2, 3, 4);
|
||||
|
||||
mem_fn(&X::f5)(x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::f5)(&x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::f5)(sp, 1, 2, 3, 4, 5);
|
||||
|
||||
mem_fn(&X::g5)(x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(rcx, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(&x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(pcx, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(sp, 1, 2, 3, 4, 5);
|
||||
|
||||
mem_fn(&X::f6)(x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::f6)(&x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::f6)(sp, 1, 2, 3, 4, 5, 6);
|
||||
|
||||
mem_fn(&X::g6)(x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(rcx, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(&x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(pcx, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(sp, 1, 2, 3, 4, 5, 6);
|
||||
|
||||
mem_fn(&X::f7)(x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::f7)(&x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::f7)(sp, 1, 2, 3, 4, 5, 6, 7);
|
||||
|
||||
mem_fn(&X::g7)(x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(rcx, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(&x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(pcx, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(sp, 1, 2, 3, 4, 5, 6, 7);
|
||||
|
||||
mem_fn(&X::f8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::f8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::f8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
mem_fn(&X::g8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(rcx, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(pcx, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
return detect_errors(x.hash == 17610 && sp->hash == 2155);
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4514) // unreferenced inline removed
|
||||
#endif
|
||||
|
||||
//
|
||||
// mem_fn_stdcall_test.cpp - a test for mem_fn.hpp + __stdcall
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#define BOOST_MEM_FN_ENABLE_STDCALL
|
||||
|
||||
#include <boost/mem_fn.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
struct X
|
||||
{
|
||||
mutable unsigned int hash;
|
||||
|
||||
X(): hash(0) {}
|
||||
|
||||
int __stdcall f0() { f1(17); return 0; }
|
||||
int __stdcall g0() const { g1(17); return 0; }
|
||||
|
||||
int __stdcall f1(int a1) { hash = (hash * 17041 + a1) % 32768; return 0; }
|
||||
int __stdcall g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; return 0; }
|
||||
|
||||
int __stdcall f2(int a1, int a2) { f1(a1); f1(a2); return 0; }
|
||||
int __stdcall g2(int a1, int a2) const { g1(a1); g1(a2); return 0; }
|
||||
|
||||
int __stdcall f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); return 0; }
|
||||
int __stdcall g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); return 0; }
|
||||
|
||||
int __stdcall f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); return 0; }
|
||||
int __stdcall g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); return 0; }
|
||||
|
||||
int __stdcall f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); return 0; }
|
||||
int __stdcall g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); return 0; }
|
||||
|
||||
int __stdcall f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); return 0; }
|
||||
int __stdcall g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); return 0; }
|
||||
|
||||
int __stdcall f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); return 0; }
|
||||
int __stdcall g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); return 0; }
|
||||
|
||||
int __stdcall f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); return 0; }
|
||||
int __stdcall g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); return 0; }
|
||||
};
|
||||
|
||||
int detect_errors(bool x)
|
||||
{
|
||||
if(x)
|
||||
{
|
||||
std::cerr << "no errors detected.\n";
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "test failed.\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
using boost::mem_fn;
|
||||
|
||||
X x;
|
||||
|
||||
X const & rcx = x;
|
||||
X const * pcx = &x;
|
||||
|
||||
boost::shared_ptr<X> sp(new X);
|
||||
|
||||
mem_fn(&X::f0)(x);
|
||||
mem_fn(&X::f0)(&x);
|
||||
mem_fn(&X::f0)(sp);
|
||||
|
||||
mem_fn(&X::g0)(x);
|
||||
mem_fn(&X::g0)(rcx);
|
||||
mem_fn(&X::g0)(&x);
|
||||
mem_fn(&X::g0)(pcx);
|
||||
mem_fn(&X::g0)(sp);
|
||||
|
||||
mem_fn(&X::f1)(x, 1);
|
||||
mem_fn(&X::f1)(&x, 1);
|
||||
mem_fn(&X::f1)(sp, 1);
|
||||
|
||||
mem_fn(&X::g1)(x, 1);
|
||||
mem_fn(&X::g1)(rcx, 1);
|
||||
mem_fn(&X::g1)(&x, 1);
|
||||
mem_fn(&X::g1)(pcx, 1);
|
||||
mem_fn(&X::g1)(sp, 1);
|
||||
|
||||
mem_fn(&X::f2)(x, 1, 2);
|
||||
mem_fn(&X::f2)(&x, 1, 2);
|
||||
mem_fn(&X::f2)(sp, 1, 2);
|
||||
|
||||
mem_fn(&X::g2)(x, 1, 2);
|
||||
mem_fn(&X::g2)(rcx, 1, 2);
|
||||
mem_fn(&X::g2)(&x, 1, 2);
|
||||
mem_fn(&X::g2)(pcx, 1, 2);
|
||||
mem_fn(&X::g2)(sp, 1, 2);
|
||||
|
||||
mem_fn(&X::f3)(x, 1, 2, 3);
|
||||
mem_fn(&X::f3)(&x, 1, 2, 3);
|
||||
mem_fn(&X::f3)(sp, 1, 2, 3);
|
||||
|
||||
mem_fn(&X::g3)(x, 1, 2, 3);
|
||||
mem_fn(&X::g3)(rcx, 1, 2, 3);
|
||||
mem_fn(&X::g3)(&x, 1, 2, 3);
|
||||
mem_fn(&X::g3)(pcx, 1, 2, 3);
|
||||
mem_fn(&X::g3)(sp, 1, 2, 3);
|
||||
|
||||
mem_fn(&X::f4)(x, 1, 2, 3, 4);
|
||||
mem_fn(&X::f4)(&x, 1, 2, 3, 4);
|
||||
mem_fn(&X::f4)(sp, 1, 2, 3, 4);
|
||||
|
||||
mem_fn(&X::g4)(x, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(rcx, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(&x, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(pcx, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(sp, 1, 2, 3, 4);
|
||||
|
||||
mem_fn(&X::f5)(x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::f5)(&x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::f5)(sp, 1, 2, 3, 4, 5);
|
||||
|
||||
mem_fn(&X::g5)(x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(rcx, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(&x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(pcx, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(sp, 1, 2, 3, 4, 5);
|
||||
|
||||
mem_fn(&X::f6)(x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::f6)(&x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::f6)(sp, 1, 2, 3, 4, 5, 6);
|
||||
|
||||
mem_fn(&X::g6)(x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(rcx, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(&x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(pcx, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(sp, 1, 2, 3, 4, 5, 6);
|
||||
|
||||
mem_fn(&X::f7)(x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::f7)(&x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::f7)(sp, 1, 2, 3, 4, 5, 6, 7);
|
||||
|
||||
mem_fn(&X::g7)(x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(rcx, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(&x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(pcx, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(sp, 1, 2, 3, 4, 5, 6, 7);
|
||||
|
||||
mem_fn(&X::f8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::f8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::f8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
mem_fn(&X::g8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(rcx, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(pcx, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
return detect_errors(x.hash == 17610 && sp->hash == 2155);
|
||||
}
|
||||
@@ -1,185 +0,0 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4710) // function not inlined
|
||||
#pragma warning(disable: 4711) // function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4514) // unreferenced inline removed
|
||||
#endif
|
||||
|
||||
//
|
||||
// mem_fn_void_test.cpp - a test for mem_fn.hpp + void returns
|
||||
//
|
||||
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#include <boost/mem_fn.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
struct X
|
||||
{
|
||||
mutable unsigned int hash;
|
||||
|
||||
X(): hash(0) {}
|
||||
|
||||
void f0() { f1(17); }
|
||||
void g0() const { g1(17); }
|
||||
|
||||
void f1(int a1) { hash = (hash * 17041 + a1) % 32768; }
|
||||
void g1(int a1) const { hash = (hash * 17041 + a1 * 2) % 32768; }
|
||||
|
||||
void f2(int a1, int a2) { f1(a1); f1(a2); }
|
||||
void g2(int a1, int a2) const { g1(a1); g1(a2); }
|
||||
|
||||
void f3(int a1, int a2, int a3) { f2(a1, a2); f1(a3); }
|
||||
void g3(int a1, int a2, int a3) const { g2(a1, a2); g1(a3); }
|
||||
|
||||
void f4(int a1, int a2, int a3, int a4) { f3(a1, a2, a3); f1(a4); }
|
||||
void g4(int a1, int a2, int a3, int a4) const { g3(a1, a2, a3); g1(a4); }
|
||||
|
||||
void f5(int a1, int a2, int a3, int a4, int a5) { f4(a1, a2, a3, a4); f1(a5); }
|
||||
void g5(int a1, int a2, int a3, int a4, int a5) const { g4(a1, a2, a3, a4); g1(a5); }
|
||||
|
||||
void f6(int a1, int a2, int a3, int a4, int a5, int a6) { f5(a1, a2, a3, a4, a5); f1(a6); }
|
||||
void g6(int a1, int a2, int a3, int a4, int a5, int a6) const { g5(a1, a2, a3, a4, a5); g1(a6); }
|
||||
|
||||
void f7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { f6(a1, a2, a3, a4, a5, a6); f1(a7); }
|
||||
void g7(int a1, int a2, int a3, int a4, int a5, int a6, int a7) const { g6(a1, a2, a3, a4, a5, a6); g1(a7); }
|
||||
|
||||
void f8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { f7(a1, a2, a3, a4, a5, a6, a7); f1(a8); }
|
||||
void g8(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) const { g7(a1, a2, a3, a4, a5, a6, a7); g1(a8); }
|
||||
};
|
||||
|
||||
int detect_errors(bool x)
|
||||
{
|
||||
if(x)
|
||||
{
|
||||
std::cerr << "no errors detected.\n";
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "test failed.\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
using boost::mem_fn;
|
||||
|
||||
X x;
|
||||
|
||||
X const & rcx = x;
|
||||
X const * pcx = &x;
|
||||
|
||||
boost::shared_ptr<X> sp(new X);
|
||||
|
||||
mem_fn(&X::f0)(x);
|
||||
mem_fn(&X::f0)(&x);
|
||||
mem_fn(&X::f0)(sp);
|
||||
|
||||
mem_fn(&X::g0)(x);
|
||||
mem_fn(&X::g0)(rcx);
|
||||
mem_fn(&X::g0)(&x);
|
||||
mem_fn(&X::g0)(pcx);
|
||||
mem_fn(&X::g0)(sp);
|
||||
|
||||
mem_fn(&X::f1)(x, 1);
|
||||
mem_fn(&X::f1)(&x, 1);
|
||||
mem_fn(&X::f1)(sp, 1);
|
||||
|
||||
mem_fn(&X::g1)(x, 1);
|
||||
mem_fn(&X::g1)(rcx, 1);
|
||||
mem_fn(&X::g1)(&x, 1);
|
||||
mem_fn(&X::g1)(pcx, 1);
|
||||
mem_fn(&X::g1)(sp, 1);
|
||||
|
||||
mem_fn(&X::f2)(x, 1, 2);
|
||||
mem_fn(&X::f2)(&x, 1, 2);
|
||||
mem_fn(&X::f2)(sp, 1, 2);
|
||||
|
||||
mem_fn(&X::g2)(x, 1, 2);
|
||||
mem_fn(&X::g2)(rcx, 1, 2);
|
||||
mem_fn(&X::g2)(&x, 1, 2);
|
||||
mem_fn(&X::g2)(pcx, 1, 2);
|
||||
mem_fn(&X::g2)(sp, 1, 2);
|
||||
|
||||
mem_fn(&X::f3)(x, 1, 2, 3);
|
||||
mem_fn(&X::f3)(&x, 1, 2, 3);
|
||||
mem_fn(&X::f3)(sp, 1, 2, 3);
|
||||
|
||||
mem_fn(&X::g3)(x, 1, 2, 3);
|
||||
mem_fn(&X::g3)(rcx, 1, 2, 3);
|
||||
mem_fn(&X::g3)(&x, 1, 2, 3);
|
||||
mem_fn(&X::g3)(pcx, 1, 2, 3);
|
||||
mem_fn(&X::g3)(sp, 1, 2, 3);
|
||||
|
||||
mem_fn(&X::f4)(x, 1, 2, 3, 4);
|
||||
mem_fn(&X::f4)(&x, 1, 2, 3, 4);
|
||||
mem_fn(&X::f4)(sp, 1, 2, 3, 4);
|
||||
|
||||
mem_fn(&X::g4)(x, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(rcx, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(&x, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(pcx, 1, 2, 3, 4);
|
||||
mem_fn(&X::g4)(sp, 1, 2, 3, 4);
|
||||
|
||||
mem_fn(&X::f5)(x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::f5)(&x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::f5)(sp, 1, 2, 3, 4, 5);
|
||||
|
||||
mem_fn(&X::g5)(x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(rcx, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(&x, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(pcx, 1, 2, 3, 4, 5);
|
||||
mem_fn(&X::g5)(sp, 1, 2, 3, 4, 5);
|
||||
|
||||
mem_fn(&X::f6)(x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::f6)(&x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::f6)(sp, 1, 2, 3, 4, 5, 6);
|
||||
|
||||
mem_fn(&X::g6)(x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(rcx, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(&x, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(pcx, 1, 2, 3, 4, 5, 6);
|
||||
mem_fn(&X::g6)(sp, 1, 2, 3, 4, 5, 6);
|
||||
|
||||
mem_fn(&X::f7)(x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::f7)(&x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::f7)(sp, 1, 2, 3, 4, 5, 6, 7);
|
||||
|
||||
mem_fn(&X::g7)(x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(rcx, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(&x, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(pcx, 1, 2, 3, 4, 5, 6, 7);
|
||||
mem_fn(&X::g7)(sp, 1, 2, 3, 4, 5, 6, 7);
|
||||
|
||||
mem_fn(&X::f8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::f8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::f8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
mem_fn(&X::g8)(x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(rcx, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(&x, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(pcx, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
mem_fn(&X::g8)(sp, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
return detect_errors(x.hash == 17610 && sp->hash == 2155);
|
||||
}
|
||||
Reference in New Issue
Block a user