From b9bb33048f332890496d377135e9ae91eb0d0253 Mon Sep 17 00:00:00 2001
From: Peter Dimov
Date: Thu, 18 Oct 2001 14:12:39 +0000
Subject: [PATCH] Removed bind_test_?.cpp
[SVN r11400]
---
bind.html | 9 +-
bind_test_1.cpp | 104 ------------------
bind_test_2.cpp | 65 -----------
bind_test_3.cpp | 161 ----------------------------
bind_test_4.cpp => bind_visitor.cpp | 4 +-
5 files changed, 5 insertions(+), 338 deletions(-)
delete mode 100644 bind_test_1.cpp
delete mode 100644 bind_test_2.cpp
delete mode 100644 bind_test_3.cpp
rename bind_test_4.cpp => bind_visitor.cpp (95%)
diff --git a/bind.html b/bind.html
index a7ed00c..e9889c4 100644
--- a/bind.html
+++ b/bind.html
@@ -29,12 +29,9 @@
Files
Purpose
@@ -658,7 +655,7 @@ that applies v, as a function object, to its internal state. Using
-See bind_test_4.cpp for an example.
+See bind_visitor.cpp for an example.
Acknowledgements
diff --git a/bind_test_1.cpp b/bind_test_1.cpp
deleted file mode 100644
index b456dbe..0000000
--- a/bind_test_1.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-#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
-#include
-
-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 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);
-}
diff --git a/bind_test_2.cpp b/bind_test_2.cpp
deleted file mode 100644
index ac7b6b8..0000000
--- a/bind_test_2.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#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
-#include
-#include
-
-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 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(X(), ref(i)), 1);
- test(bind(X(), ref(i)), 2);
- test(bind(X(), i, _1), 3);
- test(bind(X(), i, _1, 9), 4);
-
- return detect_errors(hash == 24857);
-}
diff --git a/bind_test_3.cpp b/bind_test_3.cpp
deleted file mode 100644
index 067c75e..0000000
--- a/bind_test_3.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-#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_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.
-//
-// 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
-#include
-#include
-
-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; }
-};
-
-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;
-
- 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)();
-
- return detect_errors(x.hash == 23558);
-}
diff --git a/bind_test_4.cpp b/bind_visitor.cpp
similarity index 95%
rename from bind_test_4.cpp
rename to bind_visitor.cpp
index d0ce912..2a75d0e 100644
--- a/bind_test_4.cpp
+++ b/bind_visitor.cpp
@@ -6,9 +6,9 @@
#endif
//
-// bind_test_4.cpp - tests bind.hpp with a visitor
+// bind_visitor.cpp - tests bind.hpp with a visitor
//
-// Version 1.00.0003 (2001-08-30)
+// Version 1.00.0003 (2001-10-18)
//
// Copyright (c) 2001 Peter Dimov and Multi Media Ltd.
//