diff --git a/test/Jamfile b/test/Jamfile index 20b49e6..68776a9 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -1,3 +1,17 @@ +# Function library + +# Copyright (C) 2001-2003 Douglas Gregor + +# Permission to copy, use, sell and distribute this software is granted +# provided this copyright notice appears in all copies. Permission to modify +# the code and to distribute modified code is granted provided this copyright +# notice appears in all copies, and a notice that the code was modified is +# included with the copyright notice. This software is provided "as is" +# without express or implied warranty, and with no claim as to its suitability +# for any purpose. + +# For more information, see http://www.boost.org/ + # Testing Jamfile autogenerated from XML source subproject libs/function/test ; @@ -15,7 +29,7 @@ DEPENDS all : test ; test-suite function : - [ run libs/function/test/function_test.cpp : : : : lib_function_test ] + [ run libs/function/test/function_test.cpp ] [ run libs/function/test/function_n_test.cpp ] diff --git a/test/function_30.cpp b/test/function_30.cpp index d8696d5..1fd96ed 100644 --- a/test/function_30.cpp +++ b/test/function_30.cpp @@ -1,3 +1,18 @@ +// Boost.Function library + +// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. + +// For more information, see http://www.boost.org + // Make sure we don't try to redefine function2 #include diff --git a/test/function_arith_cxx98.cpp b/test/function_arith_cxx98.cpp index 2032bf4..8903f72 100644 --- a/test/function_arith_cxx98.cpp +++ b/test/function_arith_cxx98.cpp @@ -1,41 +1,38 @@ +// Function library + +// Copyright (C) 2001-2003 Douglas Gregor + +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. Permission to modify +// the code and to distribute modified code is granted provided this copyright +// notice appears in all copies, and a notice that the code was modified is +// included with the copyright notice. This software is provided "as is" +// without express or implied warranty, and with no claim as to its +// suitability for any purpose. + +// For more information, see http://www.boost.org/ #include #include - - float mul_ints(int x, int y) { return ((float)x) * y; } - - +float mul_ints(int x, int y) { return ((float)x) * y; } struct int_div { float operator()(int x, int y) const { return ((float)x)/y; }; }; - int main() { - -boost::function f; - - -f = int_div(); - - -std::cout << f(5, 3) << std::endl; - - -if (f) + boost::function f; + f = int_div(); + std::cout << f(5, 3) << std::endl; + if (f) std::cout << f(5, 3) << std::endl; else std::cout << "f has no target, so it is unsafe to call" << std::endl; - - -f = 0; - - - f = &mul_ints; - + f = 0; + f = &mul_ints; return 0; } diff --git a/test/function_arith_portable.cpp b/test/function_arith_portable.cpp index 7556b2d..3bbc112 100644 --- a/test/function_arith_portable.cpp +++ b/test/function_arith_portable.cpp @@ -1,39 +1,36 @@ +// Function library + +// Copyright (C) 2001-2003 Douglas Gregor + +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. Permission to modify +// the code and to distribute modified code is granted provided this copyright +// notice appears in all copies, and a notice that the code was modified is +// included with the copyright notice. This software is provided "as is" +// without express or implied warranty, and with no claim as to its +// suitability for any purpose. + +// For more information, see http://www.boost.org/ #include #include - - float mul_ints(int x, int y) { return ((float)x) * y; } - - +float mul_ints(int x, int y) { return ((float)x) * y; } struct int_div { float operator()(int x, int y) const { return ((float)x)/y; }; }; - int main() { - -boost::function2 f; - - -f = int_div(); - - -std::cout << f(5, 3) << std::endl; - - -if (f) + boost::function2 f; + f = int_div(); + std::cout << f(5, 3) << std::endl; + if (f) std::cout << f(5, 3) << std::endl; else std::cout << "f has no target, so it is unsafe to call" << std::endl; - - -f = 0; - - - f = &mul_ints; - + f = 0; + f = &mul_ints; return 0; } diff --git a/test/function_ref_cxx98.cpp b/test/function_ref_cxx98.cpp index 7ec29bf..ae65c93 100644 --- a/test/function_ref_cxx98.cpp +++ b/test/function_ref_cxx98.cpp @@ -1,3 +1,16 @@ +// Function library + +// Copyright (C) 2001-2003 Douglas Gregor + +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. Permission to modify +// the code and to distribute modified code is granted provided this copyright +// notice appears in all copies, and a notice that the code was modified is +// included with the copyright notice. This software is provided "as is" +// without express or implied warranty, and with no claim as to its +// suitability for any purpose. + +// For more information, see http://www.boost.org/ #include @@ -8,13 +21,11 @@ struct stateful_type { int operator()(int) const { return 0; } }; int main() { - - stateful_type a_function_object; + stateful_type a_function_object; boost::function f; f = boost::ref(a_function_object); boost::function f2(f); - return 0; } diff --git a/test/function_ref_portable.cpp b/test/function_ref_portable.cpp index 1692a84..b9d3c9d 100644 --- a/test/function_ref_portable.cpp +++ b/test/function_ref_portable.cpp @@ -1,3 +1,16 @@ +// Function library + +// Copyright (C) 2001-2003 Douglas Gregor + +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. Permission to modify +// the code and to distribute modified code is granted provided this copyright +// notice appears in all copies, and a notice that the code was modified is +// included with the copyright notice. This software is provided "as is" +// without express or implied warranty, and with no claim as to its +// suitability for any purpose. + +// For more information, see http://www.boost.org/ #include @@ -8,13 +21,11 @@ struct stateful_type { int operator()(int) const { return 0; } }; int main() { - - stateful_type a_function_object; + stateful_type a_function_object; boost::function1 f; f = boost::ref(a_function_object); boost::function1 f2(f); - return 0; } diff --git a/test/lambda_test.cpp b/test/lambda_test.cpp index da919af..eb71a68 100644 --- a/test/lambda_test.cpp +++ b/test/lambda_test.cpp @@ -1,3 +1,18 @@ +// Boost.Function library + +// Copyright (C) 2002-2003 Doug Gregor (gregod@cs.rpi.edu) +// +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. + +// For more information, see http://www.boost.org + #include #include diff --git a/test/mem_fun_cxx98.cpp b/test/mem_fun_cxx98.cpp index 7574bba..747c73f 100644 --- a/test/mem_fun_cxx98.cpp +++ b/test/mem_fun_cxx98.cpp @@ -1,26 +1,35 @@ +// Function library + +// Copyright (C) 2001-2003 Douglas Gregor + +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. Permission to modify +// the code and to distribute modified code is granted provided this copyright +// notice appears in all copies, and a notice that the code was modified is +// included with the copyright notice. This software is provided "as is" +// without express or implied warranty, and with no claim as to its +// suitability for any purpose. + +// For more information, see http://www.boost.org/ #include #include #include - struct X { int foo(int); }; - int X::foo(int x) { return -x; } int main() { - -boost::function f; + boost::function f; f = &X::foo; X x; f(&x, 5); - return 0; } diff --git a/test/mem_fun_portable.cpp b/test/mem_fun_portable.cpp index fb4eed5..fcdada5 100644 --- a/test/mem_fun_portable.cpp +++ b/test/mem_fun_portable.cpp @@ -1,26 +1,35 @@ +// Function library + +// Copyright (C) 2001-2003 Douglas Gregor + +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. Permission to modify +// the code and to distribute modified code is granted provided this copyright +// notice appears in all copies, and a notice that the code was modified is +// included with the copyright notice. This software is provided "as is" +// without express or implied warranty, and with no claim as to its +// suitability for any purpose. + +// For more information, see http://www.boost.org/ #include #include #include - struct X { int foo(int); }; - int X::foo(int x) { return -x; } int main() { - -boost::function2 f; + boost::function2 f; f = &X::foo; X x; f(&x, 5); - return 0; } diff --git a/test/std_bind_cxx98.cpp b/test/std_bind_cxx98.cpp index 6cf1e97..a52a15e 100644 --- a/test/std_bind_cxx98.cpp +++ b/test/std_bind_cxx98.cpp @@ -1,25 +1,34 @@ +// Function library + +// Copyright (C) 2001-2003 Douglas Gregor + +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. Permission to modify +// the code and to distribute modified code is granted provided this copyright +// notice appears in all copies, and a notice that the code was modified is +// included with the copyright notice. This software is provided "as is" +// without express or implied warranty, and with no claim as to its +// suitability for any purpose. + +// For more information, see http://www.boost.org/ #include #include #include - struct X { int foo(int); }; - int X::foo(int x) { return -x; } int main() { - - boost::function f; + boost::function f; X x; - f = std::bind1st(std::mem_fun(&X::foo), &x); - + f = std::bind1st( + std::mem_fun(&X::foo), &x); f(5); // Call x.foo(5) - return 0; } diff --git a/test/std_bind_portable.cpp b/test/std_bind_portable.cpp index d4a7fdd..bc67934 100644 --- a/test/std_bind_portable.cpp +++ b/test/std_bind_portable.cpp @@ -1,25 +1,34 @@ +// Function library + +// Copyright (C) 2001-2003 Douglas Gregor + +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. Permission to modify +// the code and to distribute modified code is granted provided this copyright +// notice appears in all copies, and a notice that the code was modified is +// included with the copyright notice. This software is provided "as is" +// without express or implied warranty, and with no claim as to its +// suitability for any purpose. + +// For more information, see http://www.boost.org/ #include #include #include - struct X { int foo(int); }; - int X::foo(int x) { return -x; } int main() { - - boost::function1 f; + boost::function1 f; X x; - f = std::bind1st(std::mem_fun(&X::foo), &x); - + f = std::bind1st( + std::mem_fun(&X::foo), &x); f(5); // Call x.foo(5) - return 0; } diff --git a/test/sum_avg_cxx98.cpp b/test/sum_avg_cxx98.cpp index 9f14ae0..164474a 100644 --- a/test/sum_avg_cxx98.cpp +++ b/test/sum_avg_cxx98.cpp @@ -1,9 +1,21 @@ +// Function library + +// Copyright (C) 2001-2003 Douglas Gregor + +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. Permission to modify +// the code and to distribute modified code is granted provided this copyright +// notice appears in all copies, and a notice that the code was modified is +// included with the copyright notice. This software is provided "as is" +// without express or implied warranty, and with no claim as to its +// suitability for any purpose. + +// For more information, see http://www.boost.org/ #include #include - void do_sum_avg(int values[], int n, int& sum, float& avg) { sum = 0; @@ -11,15 +23,10 @@ void do_sum_avg(int values[], int n, int& sum, float& avg) sum += values[i]; avg = (float)sum / n; } - int main() { - -boost::function sum_avg; - - -sum_avg = &do_sum_avg; - + boost::function sum_avg; + sum_avg = &do_sum_avg; return 0; } diff --git a/test/sum_avg_portable.cpp b/test/sum_avg_portable.cpp index d33a505..e31595e 100644 --- a/test/sum_avg_portable.cpp +++ b/test/sum_avg_portable.cpp @@ -1,9 +1,21 @@ +// Function library + +// Copyright (C) 2001-2003 Douglas Gregor + +// Permission to copy, use, sell and distribute this software is granted +// provided this copyright notice appears in all copies. Permission to modify +// the code and to distribute modified code is granted provided this copyright +// notice appears in all copies, and a notice that the code was modified is +// included with the copyright notice. This software is provided "as is" +// without express or implied warranty, and with no claim as to its +// suitability for any purpose. + +// For more information, see http://www.boost.org/ #include #include - void do_sum_avg(int values[], int n, int& sum, float& avg) { sum = 0; @@ -11,15 +23,10 @@ void do_sum_avg(int values[], int n, int& sum, float& avg) sum += values[i]; avg = (float)sum / n; } - int main() { - -boost::function4 sum_avg; - - -sum_avg = &do_sum_avg; - + boost::function4 sum_avg; + sum_avg = &do_sum_avg; return 0; }