diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_Result_of_kernel.h b/Kernel_23/test/Kernel_23/include/CGAL/_Result_of_kernel.h deleted file mode 100644 index 77ecce2b662..00000000000 --- a/Kernel_23/test/Kernel_23/include/CGAL/_Result_of_kernel.h +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright (c) 2011 GeometryFactory (France). All rights reserved. -// All rights reserved. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is part of CGAL (www.cgal.org); you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; version 2.1 of the License. -// See the file LICENSE.LGPL distributed with CGAL. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Philipp Moeller - -#ifndef CGAL_RESULT_OF_KERNEL_H -#define CGAL_RESULT_OF_KERNEL_H - -#include - -#if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE) && !defined(CGAL_CFG_NO_CPP0X_STATIC_ASSERT) - -#define CGAL_RESULT_OF_KERNEL 1 - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include - - -// Unfortunately this test is only an approximation. At this point -// cpp11::result_of behaves as C++11 result_of and we cannot force it -// back into an old mode thanks to the include guards. We instead use -// a TR1 implementation of result_of to compare the types. This is the -// best we can go for. - -namespace CGAL { - // avoid crashes with what we already have in namespace internal - namespace result_of_kernel { - // required for smooth wrapping of the functors - BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) - BOOST_MPL_HAS_XXX_TRAIT_DEF(Rep) - - template - struct Lazy_is_same { - typedef boost::is_same type; - }; - - // trickery to get rid of the inequality that appears with the - // return_base_tag versions of construct calls - template, - typename - boost::mpl::eval_if< has_Rep, - Lazy_is_same, - boost::false_type >::type - >::value > - struct Rep_equal; - - template - struct Rep_equal : boost::true_type {}; - template - struct Rep_equal : boost::false_type {}; - } - - // This functor can wrap any DefaultConstructible functor. Iff there - // is a result_type typedef it needs to be forwarded. In all other - // cases cpp11::result_of is necessary to determine the return type. - template::value > - struct AnyFunctor; - - template - struct AnyFunctor { - typedef typename F::result_type result_type; - - template - auto operator()(Args&&... args) const -> typename std::result_of::type { - F f; - // check the equality of a c++03 std::tr1::result_of and a c++11 result_of - typedef typename std::result_of::type c11_return_type; - typedef typename F::result_type c03_return_type; - - static_assert((result_of_kernel::Rep_equal::value), - "Type difference between actual return type and cpp11::result_of<>::type"); - - return f(std::forward(args)...); - } - }; - - template - struct AnyFunctor { - template - struct result; - - template - struct result { - typedef typename cpp11::result_of::type type; - }; - - // same as above - template - auto operator()(Args&&... args) const -> typename std::result_of::type { - F f; - typedef typename std::result_of::type c11_return_type; - typedef typename std::tr1::result_of::type - >::type ... - )>::type c03_return_type; - - static_assert((result_of_kernel::Rep_equal::value), - "Type difference between actual return type and cpp11::result_of<>::type"); - - return f(std::forward(args)...); - } - }; - - // usual copy pasta from simple_cartesian and cartesian plus an - // template template parameter to inject the true base - template < typename RT_, typename FT_, typename Kernel_, template class Inject> - struct Result_of_base - : public Inject< RT_, FT_, Kernel_> - { - typedef RT_ RT; - typedef FT_ FT; - - // The mechanism that allows to specify reference-counting or not. - template < typename T > - struct Handle { typedef T type; }; - - template < typename Kernel2 > - struct Base { typedef Result_of_base Type; }; - }; - - // alias cartesian to something similar to Homogeneous. Requires gcc 4.7. - // NB. Kernel is either last of first argument to add a little more confusion. - - // template - // using Cartesian_base_3 = Cartesian_base; - - // hack instead - template - struct Cartesian_base_3 : public Cartesian_base { }; - - template < typename FT_, typename Kernel_ > - struct Result_of_cartesian_base : public Result_of_base - { - typedef Kernel_ K; - - #define CGAL_Kernel_pred(Y,Z) typedef CartesianKernelFunctors::Y Y; \ - Y Z() const { return Y(); } - #define CGAL_Kernel_cons(Y,Z) CGAL_Kernel_pred(Y,Z) - - #include - }; - - template < typename RT_, typename FT_, typename Kernel_ > - struct Result_of_homogeneous_base : public Result_of_base - { - typedef Kernel_ K; - - #define CGAL_Kernel_pred(Y,Z) typedef HomogeneousKernelFunctors::Y Y; \ - Y Z() const { return Y(); } - #define CGAL_Kernel_cons(Y,Z) CGAL_Kernel_pred(Y,Z) - - #include - }; - - template < typename FT_ > - struct Result_of_cartesian - : public Type_equality_wrapper< - Result_of_cartesian_base >, - Result_of_cartesian > - { - // this has to be delayed until here as AnyFunctor will - // instantiate its arguments and only here lookup for all the - // typedefs inside the functor will be possible - typedef Result_of_cartesian K; - #define CGAL_Kernel_pred(Y,Z) typedef AnyFunctor< CartesianKernelFunctors::Y > Y; \ - Y Z() const { return Y(); } - #define CGAL_Kernel_cons(Y,Z) CGAL_Kernel_pred(Y,Z) - - #include - }; - - // same as above - template < typename RT_, typename FT_ > - struct Result_of_homogeneous - : public Type_equality_wrapper< - Result_of_homogeneous_base >, - Result_of_homogeneous > - { - typedef Result_of_homogeneous K; - #define CGAL_Kernel_pred(Y,Z) typedef AnyFunctor< HomogeneousKernelFunctors::Y > Y; \ - Y Z() const { return Y(); } - #define CGAL_Kernel_cons(Y,Z) CGAL_Kernel_pred(Y,Z) - - #include - }; -} - -#endif /* C++11 GUARD */ -#endif /* CGAL_RESULT_OF_KERNEL_H */ diff --git a/Kernel_23/test/Kernel_23/test_result_of.cpp b/Kernel_23/test/Kernel_23/test_result_of.cpp deleted file mode 100644 index db467ed8452..00000000000 --- a/Kernel_23/test/Kernel_23/test_result_of.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2011 GeometryFactory (France). All rights reserved. -// All rights reserved. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is part of CGAL (www.cgal.org); you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; version 2.1 of the License. -// See the file LICENSE.LGPL distributed with CGAL. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Philipp Moeller - -#include -#include -#include - -#include "CGAL/_Result_of_kernel.h" -#include "CGAL/_test_2.h" -#include "CGAL/_test_3.h" - -#include - -#include "CGAL/Precise_numbers.h" - -template -bool test(const K& k) { - return _test_2(k) && _test_3(k); -} - -int main() -{ -#if defined(CGAL_RESULT_OF_KERNEL) - typedef CGAL::Result_of_cartesian< CGAL::Quotient > A; - typedef CGAL::Result_of_homogeneous< Precise_integer, CGAL::Quotient > B; - - test( A() ); - test( B() ); -#endif - return 0; -}