// 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_TYPESET_H #define CGAL_TYPESET_H #include #ifdef CGAL_CXX11 #include #else #include #endif // Sometimes using tuple just to list types is overkill (takes forever to // instantiate). namespace CGAL { #ifdef CGAL_CXX11 template struct typeset; template struct typeset { typedef H head; typedef typeset tail; typedef typeset type; template using contains = typename std::conditional< std::is_same::value, std::true_type, typename tail::template contains >::type; template using add = typename std::conditional< contains::value, typeset, typeset >::type; }; template<> struct typeset<> { typedef typeset type; template using contains = std::false_type; template using add = typeset; }; #else template struct typeset; template, void, typeset >::type > struct typeset { typedef typeset type; typedef H head; typedef T tail; template struct contains : boost::mpl::if_,boost::true_type,typename tail::template contains >::type {}; template struct add; //boost::mpl::if_,typeset,typeset >::type }; template<> struct typeset<> { typedef typeset type; template struct contains : boost::false_type {}; template struct add : CGAL::typeset {}; }; template template struct typeset::add : typeset::type> {}; template template struct typeset::add : typeset {}; #endif template struct typeset_union_ : typeset_union_::type, typename T2::tail> {}; template struct typeset_union_ > : T {}; template struct typeset_intersection_ { typedef typename T1::head H; typedef typename typeset_intersection_::type U; typedef typename #ifdef CGAL_CXX11 std::conditional::value, #else boost::mpl::if_, #endif typename U::template add::type, U>::type type; }; template struct typeset_intersection_,T> : typeset<> {}; #ifdef CGAL_CXX11 template using typeset_union = typename typeset_union_::type; template using typeset_intersection = typename typeset_intersection_::type; #else template struct typeset_union : typeset_union_::type {}; template struct typeset_intersection : typeset_intersection_::type {}; #endif } #endif