// Copyright (c) 2014 // INRIA Saclay-Ile de France (France) // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Marc Glisse #ifndef CGAL_ARGUMENT_SWAPS_H #define CGAL_ARGUMENT_SWAPS_H #include #include namespace CGAL { namespace internal { template struct Apply_to_last_then_rest_; template struct Apply_to_last_then_rest_ { typedef typename Apply_to_last_then_rest_::result_type result_type; inline result_type operator()(F&&f,T&&t,U&&...u)const{ return Apply_to_last_then_rest_()( std::forward(f), std::forward(u)..., std::forward(t)); } }; template struct Apply_to_last_then_rest_<0,F,T,U...> { typedef decltype(std::declval()(std::declval(), std::declval()...)) result_type; inline result_type operator()(F&&f,T&&t,U&&...u)const{ return std::forward(f)(std::forward(t), std::forward(u)...); } }; } // namespace internal struct Apply_to_last_then_rest { template inline typename internal::Apply_to_last_then_rest_::result_type operator()(F&&f,T&&t,U&&...u)const{ return internal::Apply_to_last_then_rest_()( std::forward(f), std::forward(t), std::forward(u)...); } }; } // namespace CGAL #endif // CGAL_ARGUMENT_SWAPS_H