BWAPI
|
00001 // Copyright (c) 2009 INRIA Sophia-Antipolis (France). 00002 // All rights reserved. 00003 // 00004 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public License as 00006 // published by the Free Software Foundation; version 2.1 of the License. 00007 // See the file LICENSE.LGPL distributed with CGAL. 00008 // 00009 // Licensees holding a valid commercial license may use this file in 00010 // accordance with the commercial license agreement provided with the software. 00011 // 00012 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00013 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00014 // 00015 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/STL_Extension/include/CGAL/tuple.h $ 00016 // $Id: tuple.h 49063 2009-04-30 17:28:55Z sloriot $ 00017 // 00018 // Author(s) : Sebastien Loriot, Sylvain Pion 00019 00020 #ifndef CGAL_TUPLE_H 00021 #define CGAL_TUPLE_H 00022 00023 // A wrapper around C++0x, TR1 or Boost tuple<>. 00024 // Together with the Is_in_tuple<> tool. 00025 00026 #include <CGAL/config.h> 00027 00028 #ifndef CGAL_CFG_NO_CPP0X_TUPLE 00029 # include <tuple> 00030 #elif !defined CGAL_CFG_NO_TR1_TUPLE 00031 # include <tr1/tuple> 00032 #else 00033 # include <boost/tuple/tuple.hpp> 00034 #endif 00035 00036 CGAL_BEGIN_NAMESPACE 00037 00038 namespace cpp0x { 00039 00040 #ifndef CGAL_CFG_NO_CPP0X_TUPLE 00041 using std::tuple; 00042 using std::make_tuple; 00043 using std::tie; 00044 using std::get; 00045 #elif !defined CGAL_CFG_NO_TR1_TUPLE 00046 using std::tr1::tuple; 00047 using std::tr1::make_tuple; 00048 using std::tr1::tie; 00049 using std::tr1::get; 00050 #else 00051 using boost::tuple; 00052 using boost::make_tuple; 00053 using boost::tie; 00054 using boost::get; 00055 #endif 00056 00057 } // cpp0x 00058 00059 #ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES 00060 00061 // Tool to test whether a type V is among the types of a tuple<...> = T. 00062 template <typename V, typename T> 00063 struct Is_in_tuple; 00064 00065 template <typename V, typename T0, typename... T> 00066 struct Is_in_tuple <V, cpp0x::tuple<T0, T...> > 00067 { 00068 static const bool value = Is_in_tuple<V, cpp0x::tuple<T...> >::value; 00069 }; 00070 00071 template <typename V, typename... T> 00072 struct Is_in_tuple <V, cpp0x::tuple<V, T...> > 00073 { 00074 static const bool value = true; 00075 }; 00076 00077 template <typename V> 00078 struct Is_in_tuple <V, cpp0x::tuple<> > 00079 { 00080 static const bool value = false; 00081 }; 00082 00083 #else 00084 00085 // Non-variadic version 00086 00087 template <typename V,typename T> 00088 struct Is_in_tuple; 00089 00090 template <typename V,typename T0,typename T1> 00091 struct Is_in_tuple <V,cpp0x::tuple<T0,T1> > 00092 { 00093 static const bool value = Is_in_tuple<V,cpp0x::tuple<T1> >::value; 00094 }; 00095 00096 template <typename V, typename T0,typename T1,typename T2> 00097 struct Is_in_tuple <V, cpp0x::tuple<T0,T1,T2> > 00098 { 00099 static const bool value = Is_in_tuple<V,cpp0x::tuple<T1,T2> >::value; 00100 }; 00101 00102 template <typename V, typename T0,typename T1,typename T2,typename T3> 00103 struct Is_in_tuple <V, cpp0x::tuple<T0,T1,T2,T3> > 00104 { 00105 static const bool value = Is_in_tuple<V,cpp0x::tuple<T1,T2,T3> >::value; 00106 }; 00107 00108 template <typename V, typename T0,typename T1,typename T2,typename T3,typename T4> 00109 struct Is_in_tuple <V, cpp0x::tuple<T0,T1,T2,T3,T4> > 00110 { 00111 static const bool value = Is_in_tuple<V,cpp0x::tuple<T1,T2,T3,T4> >::value; 00112 }; 00113 00114 template <typename V, typename T0,typename T1,typename T2,typename T3,typename T4,typename T5> 00115 struct Is_in_tuple <V, cpp0x::tuple<T0,T1,T2,T3,T4,T5> > 00116 { 00117 static const bool value = Is_in_tuple<V,cpp0x::tuple<T1,T2,T3,T4,T5> >::value; 00118 }; 00119 00120 template <typename V, typename T0,typename T1,typename T2,typename T3,typename T4,typename T5,typename T6> 00121 struct Is_in_tuple <V, cpp0x::tuple<T0,T1,T2,T3,T4,T5,T6> > 00122 { 00123 static const bool value = Is_in_tuple<V,cpp0x::tuple<T1,T2,T3,T4,T5,T6> >::value; 00124 }; 00125 00126 00127 //Conclusions 00128 00129 template <typename V,typename T1> 00130 struct Is_in_tuple <V,cpp0x::tuple<T1> > 00131 { 00132 static const bool value = false; 00133 }; 00134 00135 template <typename V> 00136 struct Is_in_tuple <V,cpp0x::tuple<V> > 00137 { 00138 static const bool value = true; 00139 }; 00140 00141 template <typename V,typename T1> 00142 struct Is_in_tuple <V,cpp0x::tuple<V,T1> > 00143 { 00144 static const bool value = true; 00145 }; 00146 00147 template <typename V,typename T1,typename T2> 00148 struct Is_in_tuple <V,cpp0x::tuple<V,T1,T2> > 00149 { 00150 static const bool value = true; 00151 }; 00152 00153 template <typename V,typename T1,typename T2,typename T3> 00154 struct Is_in_tuple <V,cpp0x::tuple<V,T1,T2,T3> > 00155 { 00156 static const bool value = true; 00157 }; 00158 00159 template <typename V,typename T1,typename T2,typename T3,typename T4> 00160 struct Is_in_tuple <V,cpp0x::tuple<V,T1,T2,T3,T4> > 00161 { 00162 static const bool value = true; 00163 }; 00164 00165 template <typename V,typename T1,typename T2,typename T3,typename T4,typename T5> 00166 struct Is_in_tuple <V,cpp0x::tuple<V,T1,T2,T3,T4,T5> > 00167 { 00168 static const bool value = true; 00169 }; 00170 00171 template <typename V,typename T1,typename T2,typename T3,typename T4,typename T5,typename T6> 00172 struct Is_in_tuple <V,cpp0x::tuple<V,T1,T2,T3,T4,T5,T6> > 00173 { 00174 static const bool value = true; 00175 }; 00176 00177 00178 #endif 00179 00180 CGAL_END_NAMESPACE 00181 00182 #endif // CGAL_TUPLE_H