From 34a27aaa3536c869df2671f92bf7beee6854ca5c Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 1 Jun 2014 02:17:34 +0300 Subject: [PATCH] Remove files left behind by the merge. --- addressof_fn_test.cpp | 76 ----------- addressof_np_test.cpp | 50 -------- addressof_test.cpp | 94 -------------- addressof_test2.cpp | 95 -------------- checked_delete_test.cpp | 28 ---- enable_if/test/Jamfile.v2 | 23 ---- enable_if/test/constructors.cpp | 62 --------- enable_if/test/dummy_arg_disambiguation.cpp | 46 ------- enable_if/test/lazy.cpp | 82 ------------ enable_if/test/lazy_test.cpp | 100 --------------- enable_if/test/member_templates.cpp | 43 ------- enable_if/test/namespace_disambiguation.cpp | 47 ------- enable_if/test/no_disambiguation.cpp | 43 ------- enable_if/test/partial_specializations.cpp | 67 ---------- ref_ct_test.cpp | 134 -------------------- ref_test.cpp | 121 ------------------ 16 files changed, 1111 deletions(-) delete mode 100644 addressof_fn_test.cpp delete mode 100644 addressof_np_test.cpp delete mode 100644 addressof_test.cpp delete mode 100644 addressof_test2.cpp delete mode 100644 checked_delete_test.cpp delete mode 100644 enable_if/test/Jamfile.v2 delete mode 100644 enable_if/test/constructors.cpp delete mode 100644 enable_if/test/dummy_arg_disambiguation.cpp delete mode 100644 enable_if/test/lazy.cpp delete mode 100644 enable_if/test/lazy_test.cpp delete mode 100644 enable_if/test/member_templates.cpp delete mode 100644 enable_if/test/namespace_disambiguation.cpp delete mode 100644 enable_if/test/no_disambiguation.cpp delete mode 100644 enable_if/test/partial_specializations.cpp delete mode 100644 ref_ct_test.cpp delete mode 100644 ref_test.cpp diff --git a/addressof_fn_test.cpp b/addressof_fn_test.cpp deleted file mode 100644 index 0d043bf..0000000 --- a/addressof_fn_test.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include - -#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 - -// addressof_fn_test.cpp: addressof( f ) -// -// Copyright (c) 2008, 2009 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include -#include - - -void f0() -{ -} - -void f1(int) -{ -} - -void f2(int, int) -{ -} - -void f3(int, int, int) -{ -} - -void f4(int, int, int, int) -{ -} - -void f5(int, int, int, int, int) -{ -} - -void f6(int, int, int, int, int, int) -{ -} - -void f7(int, int, int, int, int, int, int) -{ -} - -void f8(int, int, int, int, int, int, int, int) -{ -} - -void f9(int, int, int, int, int, int, int, int, int) -{ -} - -int main() -{ - BOOST_TEST( boost::addressof( f0 ) == &f0 ); - BOOST_TEST( boost::addressof( f1 ) == &f1 ); - BOOST_TEST( boost::addressof( f2 ) == &f2 ); - BOOST_TEST( boost::addressof( f3 ) == &f3 ); - BOOST_TEST( boost::addressof( f4 ) == &f4 ); - BOOST_TEST( boost::addressof( f5 ) == &f5 ); - BOOST_TEST( boost::addressof( f6 ) == &f6 ); - BOOST_TEST( boost::addressof( f7 ) == &f7 ); - BOOST_TEST( boost::addressof( f8 ) == &f8 ); - BOOST_TEST( boost::addressof( f9 ) == &f9 ); - - return boost::report_errors(); -} diff --git a/addressof_np_test.cpp b/addressof_np_test.cpp deleted file mode 100644 index 9e155d4..0000000 --- a/addressof_np_test.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// -// Copyright 2013 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// - -#include -#include -#include - -#if defined( BOOST_NO_CXX11_NULLPTR ) - -void nullptr_test() -{ -} - -#else - -void nullptr_test() -{ - { - auto x = nullptr; - BOOST_TEST( boost::addressof(x) == &x ); - } - - { - auto const x = nullptr; - BOOST_TEST( boost::addressof(x) == &x ); - } - - { - auto volatile x = nullptr; - BOOST_TEST( boost::addressof(x) == &x ); - } - - { - auto const volatile x = nullptr; - BOOST_TEST( boost::addressof(x) == &x ); - } -} - -#endif - -int main() -{ - nullptr_test(); - return boost::report_errors(); -} diff --git a/addressof_test.cpp b/addressof_test.cpp deleted file mode 100644 index 9619cc3..0000000 --- a/addressof_test.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (C) 2002 Brad King (brad.king@kitware.com) -// Douglas Gregor (gregod@cs.rpi.edu) -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - - -#include - -#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) -#pragma warning(push, 3) -#endif - -#include - -#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) -#pragma warning(pop) -#endif - -#include - -template void scalar_test( T * = 0 ) -{ - T* px = new T(); - - T& x = *px; - BOOST_TEST( boost::addressof(x) == px ); - - const T& cx = *px; - const T* pcx = boost::addressof(cx); - BOOST_TEST( pcx == px ); - - volatile T& vx = *px; - volatile T* pvx = boost::addressof(vx); - BOOST_TEST( pvx == px ); - - const volatile T& cvx = *px; - const volatile T* pcvx = boost::addressof(cvx); - BOOST_TEST( pcvx == px ); - - delete px; -} - -template void array_test( T * = 0 ) -{ - T nrg[3] = {1,2,3}; - T (*pnrg)[3] = &nrg; - BOOST_TEST( boost::addressof(nrg) == pnrg ); - - T const cnrg[3] = {1,2,3}; - T const (*pcnrg)[3] = &cnrg; - BOOST_TEST( boost::addressof(cnrg) == pcnrg ); -} - -struct addressable -{ - addressable( int = 0 ) - { - } -}; - -struct useless_type {}; - -class nonaddressable { -public: - - nonaddressable( int = 0 ) - { - } - - void dummy(); // Silence GCC warning: all member of class are private - -private: - - useless_type operator&() const; -}; - -int main() -{ - scalar_test(); - scalar_test(); - scalar_test(); - scalar_test(); - - array_test(); - array_test(); - array_test(); - array_test(); - - return boost::report_errors(); -} diff --git a/addressof_test2.cpp b/addressof_test2.cpp deleted file mode 100644 index b1c36f8..0000000 --- a/addressof_test2.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (C) 2002 Brad King (brad.king@kitware.com) -// Douglas Gregor (gregod@cs.rpi.edu) -// -// Copyright 2009 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - - -#include - -#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) -#pragma warning(push, 3) -#endif - -#include - -#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) -#pragma warning(pop) -#endif - -#include - -template void scalar_test( T * = 0 ) -{ - T* px = new T(); - - T& x = *px; - BOOST_TEST( boost::addressof(x) == px ); - - const T& cx = *px; - const T* pcx = boost::addressof(cx); - BOOST_TEST( pcx == px ); - - volatile T& vx = *px; - volatile T* pvx = boost::addressof(vx); - BOOST_TEST( pvx == px ); - - const volatile T& cvx = *px; - const volatile T* pcvx = boost::addressof(cvx); - BOOST_TEST( pcvx == px ); - - delete px; -} - -template void array_test( T * = 0 ) -{ - T nrg[3] = {1,2,3}; - T (*pnrg)[3] = &nrg; - BOOST_TEST( boost::addressof(nrg) == pnrg ); - - T const cnrg[3] = {1,2,3}; - T const (*pcnrg)[3] = &cnrg; - BOOST_TEST( boost::addressof(cnrg) == pcnrg ); -} - -class convertible { -public: - - convertible( int = 0 ) - { - } - - template operator U () const - { - return U(); - } -}; - -class convertible2 { -public: - - convertible2( int = 0 ) - { - } - - operator convertible2* () const - { - return 0; - } -}; - -int main() -{ - scalar_test(); - scalar_test(); - - array_test(); - array_test(); - - return boost::report_errors(); -} diff --git a/checked_delete_test.cpp b/checked_delete_test.cpp deleted file mode 100644 index 41fdc9a..0000000 --- a/checked_delete_test.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// Boost checked_delete test program ---------------------------------------// - -// Copyright Beman Dawes 2001. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/utility for documentation. - -// Revision History -// 21 May 01 Initial version (Beman Dawes) - -#include // for checked_delete - -// This program demonstrates compiler errors when trying to delete an -// incomplete type. - -namespace -{ - class Incomplete; -} - -int main() -{ - Incomplete * p = 0; - boost::checked_delete(p); // should cause compile time error - boost::checked_array_delete(p); // should cause compile time error - return 0; -} // main diff --git a/enable_if/test/Jamfile.v2 b/enable_if/test/Jamfile.v2 deleted file mode 100644 index 77a8798..0000000 --- a/enable_if/test/Jamfile.v2 +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright David Abrahams 2003. -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -# For more information, see http://www.boost.org/ - -project - : requirements /boost/test//boost_test_exec_monitor - ; - -test-suite utility/enable_if - : - [ run constructors.cpp ] - [ run dummy_arg_disambiguation.cpp ] - [ run lazy.cpp ] - [ run lazy_test.cpp ] - [ run member_templates.cpp ] - [ run namespace_disambiguation.cpp ] - [ run no_disambiguation.cpp ] - [ run partial_specializations.cpp ] - ; - diff --git a/enable_if/test/constructors.cpp b/enable_if/test/constructors.cpp deleted file mode 100644 index 0d465de..0000000 --- a/enable_if/test/constructors.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// Boost enable_if library - -// Copyright 2003 (c) The Trustees of Indiana University. - -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) -// Jeremiah Willcock (jewillco at osl.iu.edu) -// Andrew Lumsdaine (lums at osl.iu.edu) - -#include - -#include -#include - -using boost::enable_if; -using boost::disable_if; -using boost::is_arithmetic; - -struct container { - bool my_value; - - template - container(const T&, const typename enable_if, T>::type * = 0): - my_value(true) {} - - template - container(const T&, const typename disable_if, T>::type * = 0): - my_value(false) {} -}; - -// example from Howard Hinnant (tests enable_if template members of a templated class) -template -struct xstring -{ - template - xstring(It begin, It end, typename - disable_if >::type* = 0) - : data(end-begin) {} - - int data; -}; - - -int test_main(int, char*[]) -{ - - BOOST_CHECK(container(1).my_value); - BOOST_CHECK(container(1.0).my_value); - - BOOST_CHECK(!container("1").my_value); - BOOST_CHECK(!container(static_cast(0)).my_value); - - char sa[] = "123456"; - BOOST_CHECK(xstring(sa, sa+6).data == 6); - - - return 0; -} - diff --git a/enable_if/test/dummy_arg_disambiguation.cpp b/enable_if/test/dummy_arg_disambiguation.cpp deleted file mode 100644 index 60dfdfd..0000000 --- a/enable_if/test/dummy_arg_disambiguation.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// Boost enable_if library - -// Copyright 2003 (c) The Trustees of Indiana University. - -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) -// Jeremiah Willcock (jewillco at osl.iu.edu) -// Andrew Lumsdaine (lums at osl.iu.edu) - -#include - -#include -#include - -using boost::enable_if; -using boost::disable_if; -using boost::is_arithmetic; - -template struct dummy { - dummy(int) {}; -}; - -template -typename enable_if, bool>::type -arithmetic_object(T t, dummy<0> = 0) { return true; } - -template -typename disable_if, bool>::type -arithmetic_object(T t, dummy<1> = 0) { return false; } - - -int test_main(int, char*[]) -{ - - BOOST_CHECK(arithmetic_object(1)); - BOOST_CHECK(arithmetic_object(1.0)); - - BOOST_CHECK(!arithmetic_object("1")); - BOOST_CHECK(!arithmetic_object(static_cast(0))); - - return 0; -} - diff --git a/enable_if/test/lazy.cpp b/enable_if/test/lazy.cpp deleted file mode 100644 index f04111e..0000000 --- a/enable_if/test/lazy.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// Boost enable_if library - -// Copyright 2003 (c) The Trustees of Indiana University. - -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) -// Jeremiah Willcock (jewillco at osl.iu.edu) -// Andrew Lumsdaine (lums at osl.iu.edu) - -#include - -#include -#include - -using boost::enable_if_c; -using boost::lazy_enable_if_c; - -// This class provides a reduced example of a traits class for -// computing the result of multiplying two types. The member typedef -// 'type' in this traits class defines the return type of this -// operator. The return type member is invalid unless both arguments -// for mult_traits are values that mult_traits expects (ints in this -// case). This kind of situation may arise if a traits class only -// makes sense for some set of types, not all C++ types. - -template struct is_int { - BOOST_STATIC_CONSTANT(bool, value = (boost::is_same::value)); -}; - -template -struct mult_traits { - typedef typename T::does_not_exist type; -}; - -template <> -struct mult_traits { - typedef int type; -}; - - -// Next, a forwarding function mult() is defined. It is enabled only -// when both arguments are of type int. The first version, using -// non-lazy enable_if_c does not work. - -#if 0 -template -typename enable_if_c< - is_int::value && is_int::value, - typename mult_traits::type ->::type -mult(const T& x, const U& y) {return x * y;} -#endif - -// A correct version uses lazy_enable_if_c. -// This template removes compiler errors from invalid code used as an -// argument to enable_if_c. - -#if 1 -template -typename lazy_enable_if_c< - is_int::value & is_int::value, - mult_traits ->::type -mult(const T& x, const U& y) {return x * y;} -#endif - -double mult(int i, double d) { return (double)i * d; } - -int test_main(int, char*[]) -{ - - - BOOST_CHECK(mult(1, 2) == 2); - - BOOST_CHECK(mult(1, 3.0) == 3.0); - - return 0; -} - diff --git a/enable_if/test/lazy_test.cpp b/enable_if/test/lazy_test.cpp deleted file mode 100644 index 9ec5324..0000000 --- a/enable_if/test/lazy_test.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// Boost enable_if library - -// Copyright 2003 (c) The Trustees of Indiana University. - -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) -// Jeremiah Willcock (jewillco at osl.iu.edu) -// Andrew Lumsdaine (lums at osl.iu.edu) - -// Testing all variations of lazy_enable_if. - -#include -#include - -#include -#include - -using boost::lazy_enable_if; -using boost::lazy_disable_if; - -using boost::lazy_enable_if_c; -using boost::lazy_disable_if_c; - - -template -struct is_int_or_double { - BOOST_STATIC_CONSTANT(bool, - value = (boost::is_same::value || - boost::is_same::value)); -}; - -template -struct some_traits { - typedef typename T::does_not_exist type; -}; - -template <> -struct some_traits { - typedef bool type; -}; - -template <> -struct some_traits { - typedef bool type; -}; - -template -struct make_bool { - typedef bool type; -}; - -template <> -struct make_bool {}; - -template <> -struct make_bool {}; - -namespace A { - - template - typename lazy_enable_if, some_traits >::type - foo(T t) { return true; } - - template - typename lazy_enable_if_c::value, some_traits >::type - foo2(T t) { return true; } -} - -namespace B { - template - typename lazy_disable_if, make_bool >::type - foo(T t) { return false; } - - template - typename lazy_disable_if_c::value, make_bool >::type - foo2(T t) { return false; } -} - -int test_main(int, char*[]) -{ - using namespace A; - using namespace B; - BOOST_CHECK(foo(1)); - BOOST_CHECK(foo(1.0)); - - BOOST_CHECK(!foo("1")); - BOOST_CHECK(!foo(static_cast(0))); - - BOOST_CHECK(foo2(1)); - BOOST_CHECK(foo2(1.0)); - - BOOST_CHECK(!foo2("1")); - BOOST_CHECK(!foo2(static_cast(0))); - - return 0; -} - diff --git a/enable_if/test/member_templates.cpp b/enable_if/test/member_templates.cpp deleted file mode 100644 index 55e2d80..0000000 --- a/enable_if/test/member_templates.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// Boost enable_if library - -// Copyright 2003 (c) The Trustees of Indiana University. - -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) -// Jeremiah Willcock (jewillco at osl.iu.edu) -// Andrew Lumsdaine (lums at osl.iu.edu) - -#include - -#include -#include - -using boost::enable_if; -using boost::disable_if; -using boost::is_arithmetic; - -struct container { - template - typename enable_if, bool>::type - arithmetic_object(const T&, const int* /* disambiguate */ = 0) {return true;} - - template - typename disable_if, bool>::type - arithmetic_object(const T&) {return false;} -}; - -int test_main(int, char*[]) -{ - - BOOST_CHECK(container().arithmetic_object(1)); - BOOST_CHECK(container().arithmetic_object(1.0)); - - BOOST_CHECK(!container().arithmetic_object("1")); - BOOST_CHECK(!container().arithmetic_object(static_cast(0))); - - return 0; -} - diff --git a/enable_if/test/namespace_disambiguation.cpp b/enable_if/test/namespace_disambiguation.cpp deleted file mode 100644 index 45d4f0a..0000000 --- a/enable_if/test/namespace_disambiguation.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Boost enable_if library - -// Copyright 2003 (c) The Trustees of Indiana University. - -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) -// Jeremiah Willcock (jewillco at osl.iu.edu) -// Andrew Lumsdaine (lums at osl.iu.edu) - -#include -#include - -#include -#include - -using boost::enable_if; -using boost::mpl::not_; -using boost::is_arithmetic; - -namespace A { - template - typename enable_if, bool>::type - arithmetic_object(T t) { return true; } -} - -namespace B { - template - typename enable_if >, bool>::type - arithmetic_object(T t) { return false; } -} - -int test_main(int, char*[]) -{ - using namespace A; - using namespace B; - BOOST_CHECK(arithmetic_object(1)); - BOOST_CHECK(arithmetic_object(1.0)); - - BOOST_CHECK(!arithmetic_object("1")); - BOOST_CHECK(!arithmetic_object(static_cast(0))); - - return 0; -} - diff --git a/enable_if/test/no_disambiguation.cpp b/enable_if/test/no_disambiguation.cpp deleted file mode 100644 index e2416ed..0000000 --- a/enable_if/test/no_disambiguation.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// Boost enable_if library - -// Copyright 2003 (c) The Trustees of Indiana University. - -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) -// Jeremiah Willcock (jewillco at osl.iu.edu) -// Andrew Lumsdaine (lums at osl.iu.edu) - -#include -#include - -#include -#include - -using boost::mpl::not_; -using boost::enable_if; -using boost::is_arithmetic; - -template -typename enable_if, bool>::type -arithmetic_object(T t) { return true; } - -template -typename enable_if >, bool>::type -arithmetic_object(T t) { return false; } - - -int test_main(int, char*[]) -{ - - BOOST_CHECK(arithmetic_object(1)); - BOOST_CHECK(arithmetic_object(1.0)); - - BOOST_CHECK(!arithmetic_object("1")); - BOOST_CHECK(!arithmetic_object(static_cast(0))); - - return 0; -} - diff --git a/enable_if/test/partial_specializations.cpp b/enable_if/test/partial_specializations.cpp deleted file mode 100644 index 1d4db99..0000000 --- a/enable_if/test/partial_specializations.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// Boost enable_if library - -// Copyright 2003 (c) The Trustees of Indiana University. - -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) -// Jeremiah Willcock (jewillco at osl.iu.edu) -// Andrew Lumsdaine (lums at osl.iu.edu) - -#include - -#include -#include - -using boost::enable_if_c; -using boost::disable_if_c; -using boost::enable_if; -using boost::disable_if; -using boost::is_arithmetic; - -template -struct tester; - -template -struct tester::value>::type> { - BOOST_STATIC_CONSTANT(bool, value = true); -}; - -template -struct tester::value>::type> { - BOOST_STATIC_CONSTANT(bool, value = false); -}; - -template -struct tester2; - -template -struct tester2 >::type> { - BOOST_STATIC_CONSTANT(bool, value = true); -}; - -template -struct tester2 >::type> { - BOOST_STATIC_CONSTANT(bool, value = false); -}; - -int test_main(int, char*[]) -{ - - BOOST_CHECK(tester::value); - BOOST_CHECK(tester::value); - - BOOST_CHECK(!tester::value); - BOOST_CHECK(!tester::value); - - BOOST_CHECK(tester2::value); - BOOST_CHECK(tester2::value); - - BOOST_CHECK(!tester2::value); - BOOST_CHECK(!tester2::value); - - return 0; -} - diff --git a/ref_ct_test.cpp b/ref_ct_test.cpp deleted file mode 100644 index a3b5eea..0000000 --- a/ref_ct_test.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright David Abrahams and Aleksey Gurtovoy -// 2002-2004. Distributed under the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// compile-time test for "boost/ref.hpp" header content -// see 'ref_test.cpp' for run-time part - -#include -#include -#include -#include -#include - -#include - -namespace { - -template< typename T, typename U > -void ref_test(boost::reference_wrapper) -{ - typedef typename boost::reference_wrapper::type type; - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); -} - -template< typename T > -void assignable_test(T x) -{ - x = x; -} - -template< bool R, typename T > -void is_reference_wrapper_test(T) -{ - BOOST_STATIC_ASSERT(boost::is_reference_wrapper::value == R); -} - -template< typename R, typename Ref > -void cxx_reference_test(Ref) -{ -#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) - typedef typename boost::remove_const::type ref; - BOOST_STATIC_ASSERT((boost::is_same::value)); -#else - BOOST_STATIC_ASSERT((boost::is_same::value)); -#endif -} - -template< typename R, typename Ref > -void unwrap_reference_test(Ref) -{ -#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) - typedef typename boost::remove_const::type ref; - typedef typename boost::unwrap_reference::type type; -#else - typedef typename boost::unwrap_reference::type type; -#endif - BOOST_STATIC_ASSERT((boost::is_same::value)); -} - -} // namespace - -int main() -{ - int i = 0; - int& ri = i; - - int const ci = 0; - int const& rci = ci; - - // 'ref/cref' functions test - ref_test(boost::ref(i)); - ref_test(boost::ref(ri)); - ref_test(boost::ref(ci)); - ref_test(boost::ref(rci)); - - ref_test(boost::cref(i)); - ref_test(boost::cref(ri)); - ref_test(boost::cref(ci)); - ref_test(boost::cref(rci)); - - // test 'assignable' requirement - assignable_test(boost::ref(i)); - assignable_test(boost::ref(ri)); - assignable_test(boost::cref(i)); - assignable_test(boost::cref(ci)); - assignable_test(boost::cref(rci)); - - // 'is_reference_wrapper' test - is_reference_wrapper_test(boost::ref(i)); - is_reference_wrapper_test(boost::ref(ri)); - is_reference_wrapper_test(boost::cref(i)); - is_reference_wrapper_test(boost::cref(ci)); - is_reference_wrapper_test(boost::cref(rci)); - - is_reference_wrapper_test(i); - is_reference_wrapper_test(ri); - is_reference_wrapper_test(ci); - is_reference_wrapper_test(rci); - - // ordinary references/function template arguments deduction test - cxx_reference_test(i); - cxx_reference_test(ri); - cxx_reference_test(ci); - cxx_reference_test(rci); - - cxx_reference_test(i); - cxx_reference_test(ri); - cxx_reference_test(i); - cxx_reference_test(ri); - cxx_reference_test(ci); - cxx_reference_test(rci); - - // 'unwrap_reference' test - unwrap_reference_test(boost::ref(i)); - unwrap_reference_test(boost::ref(ri)); - unwrap_reference_test(boost::cref(i)); - unwrap_reference_test(boost::cref(ci)); - unwrap_reference_test(boost::cref(rci)); - - unwrap_reference_test(i); - unwrap_reference_test(ri); - unwrap_reference_test(ci); - unwrap_reference_test(rci); - unwrap_reference_test(i); - unwrap_reference_test(ri); - unwrap_reference_test(i); - unwrap_reference_test(ri); - unwrap_reference_test(ci); - unwrap_reference_test(rci); - - return 0; -} diff --git a/ref_test.cpp b/ref_test.cpp deleted file mode 100644 index 71481fa..0000000 --- a/ref_test.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright David Abrahams and Aleksey Gurtovoy -// 2002-2004. Distributed under the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// run-time test for "boost/ref.hpp" header content -// see 'ref_ct_test.cpp' for compile-time part - -#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 - -#include - -#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) -# pragma warning(push, 3) -#endif - -#include - -#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) -# pragma warning(pop) -#endif - - -#define BOOST_INCLUDE_MAIN -#include - -namespace { -using namespace boost; - -template -struct ref_wrapper -{ - // Used to verify implicit conversion - static T* get_pointer(T& x) - { - return &x; - } - - static T const* get_const_pointer(T const& x) - { - return &x; - } - - template - static T* passthru(Arg x) - { - return get_pointer(x); - } - - template - static T const* cref_passthru(Arg x) - { - return get_const_pointer(x); - } - - static void test(T x) - { - BOOST_CHECK(passthru(ref(x)) == &x); - BOOST_CHECK(&ref(x).get() == &x); - - BOOST_CHECK(cref_passthru(cref(x)) == &x); - BOOST_CHECK(&cref(x).get() == &x); - } -}; - -struct copy_counter { - static int count_; - copy_counter(copy_counter const& /*other*/) { - ++count_; - } - copy_counter() {} - static void reset() { count_ = 0; } - static int count() { return copy_counter::count_; } -}; - -int copy_counter::count_ = 0; - -} // namespace unnamed - -template -void do_unwrap(T t) { - - /* typename unwrap_reference::type& lt = */ - unwrap_ref(t); - -} - -void unwrap_test() { - - int i = 3; - const int ci = 2; - - do_unwrap(i); - do_unwrap(ci); - do_unwrap(ref(i)); - do_unwrap(cref(ci)); - do_unwrap(ref(ci)); - - copy_counter cc; - BOOST_CHECK(cc.count() == 0); - - do_unwrap(cc); - do_unwrap(ref(cc)); - do_unwrap(cref(cc)); - - BOOST_CHECK(cc.count() == 1); - BOOST_CHECK(unwrap_ref(ref(cc)).count() == 1); -} - -int test_main(int, char * []) -{ - ref_wrapper::test(1); - ref_wrapper::test(1); - unwrap_test(); - return 0; -}