diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-10-20 10:04:05 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-10-20 10:04:05 +0000 |
commit | 8d656e33138ef8b3a7d86a7375c92646efc29511 (patch) | |
tree | 3711227c4c1b2a6e9f25dda1db8dafb8365063a0 /src/common/include/gudhi_patches/CGAL/argument_swaps.h | |
parent | 355dc2a0ae73f243fc0aa8d7c797509d8ba5e6b4 (diff) | |
parent | 30e538a98919004e36b3b382017884486919cb6e (diff) |
Merge last trunk modification
Fix doc issue
Still doc issue
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@1739 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 0a99345f06e93a3525691699a6fe1505979e8e8e
Diffstat (limited to 'src/common/include/gudhi_patches/CGAL/argument_swaps.h')
-rw-r--r-- | src/common/include/gudhi_patches/CGAL/argument_swaps.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/src/common/include/gudhi_patches/CGAL/argument_swaps.h b/src/common/include/gudhi_patches/CGAL/argument_swaps.h new file mode 100644 index 00000000..aa16f29b --- /dev/null +++ b/src/common/include/gudhi_patches/CGAL/argument_swaps.h @@ -0,0 +1,88 @@ +// Copyright (c) 2014 +// INRIA Saclay-Ile de France (France) +// +// 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; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Marc Glisse + +#ifndef CGAL_ARGUMENT_SWAPS_H +#define CGAL_ARGUMENT_SWAPS_H + +#include <CGAL/config.h> +#include <utility> + +#ifndef CGAL_CXX11 +#include <boost/preprocessor/repetition.hpp> +#include <boost/utility/result_of.hpp> +#endif + +namespace CGAL { + +#ifdef CGAL_CXX11 + +namespace internal { + +template<int,class...> struct Apply_to_last_then_rest_; + +template<int d,class F,class T,class... U> +struct Apply_to_last_then_rest_<d,F,T,U...> { + typedef typename Apply_to_last_then_rest_<d-1,F,U...,T>::result_type result_type; + inline result_type operator()(F&&f,T&&t,U&&...u)const{ + return Apply_to_last_then_rest_<d-1,F,U...,T>()( + std::forward<F>(f), + std::forward<U>(u)..., + std::forward<T>(t)); + } +}; + +template<class F,class T,class... U> +struct Apply_to_last_then_rest_<0,F,T,U...> { + typedef decltype(std::declval<F>()(std::declval<T>(), std::declval<U>()...)) result_type; + inline result_type operator()(F&&f,T&&t,U&&...u)const{ + return std::forward<F>(f)(std::forward<T>(t), std::forward<U>(u)...); + } +}; + +} // namespace internal + + +struct Apply_to_last_then_rest { + template<class F,class T,class...U> inline + typename internal::Apply_to_last_then_rest_<sizeof...(U),F,T,U...>::result_type + operator()(F&&f,T&&t,U&&...u)const{ + return internal::Apply_to_last_then_rest_<sizeof...(U),F,T,U...>()( + std::forward<F>(f), + std::forward<T>(t), + std::forward<U>(u)...); + } +}; + +#else // CGAL_CXX11 + +struct Apply_to_last_then_rest { +#define CGAL_CODE(Z,N,_) template<class F,class T,BOOST_PP_ENUM_PARAMS(N,class T)> \ + typename boost::result_of<F(T,BOOST_PP_ENUM_PARAMS(N,T))>::type \ + operator()(F const&f, BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t), T const&t) const { \ + return f(t,BOOST_PP_ENUM_PARAMS(N,t)); \ + } + BOOST_PP_REPEAT_FROM_TO(1,11,CGAL_CODE,_) +#undef CGAL_CODE +}; + +#endif // CGAL_CXX11 + +} // namespace CGAL + +#endif // CGAL_ARGUMENT_SWAPS_H |