1.1 --- a/epoc32/include/stdapis/boost/compressed_pair.hpp Wed Mar 31 12:27:01 2010 +0100
1.2 +++ b/epoc32/include/stdapis/boost/compressed_pair.hpp Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -5,439 +5,20 @@
1.4 //
1.5 // See http://www.boost.org/libs/utility for most recent version including documentation.
1.6
1.7 -// compressed_pair: pair that "compresses" empty members
1.8 -// (see libs/utility/compressed_pair.htm)
1.9 -//
1.10 -// JM changes 25 Jan 2004:
1.11 -// For the case where T1 == T2 and both are empty, then first() and second()
1.12 -// should return different objects.
1.13 -// JM changes 25 Jan 2000:
1.14 -// Removed default arguments from compressed_pair_switch to get
1.15 -// C++ Builder 4 to accept them
1.16 -// rewriten swap to get gcc and C++ builder to compile.
1.17 -// added partial specialisations for case T1 == T2 to avoid duplicate constructor defs.
1.18 +// See boost/detail/compressed_pair.hpp and boost/detail/ob_compressed_pair.hpp
1.19 +// for full copyright notices.
1.20
1.21 -#ifndef BOOST_DETAIL_COMPRESSED_PAIR_HPP
1.22 -#define BOOST_DETAIL_COMPRESSED_PAIR_HPP
1.23 +#ifndef BOOST_COMPRESSED_PAIR_HPP
1.24 +#define BOOST_COMPRESSED_PAIR_HPP
1.25
1.26 -#include <algorithm>
1.27 +#ifndef BOOST_CONFIG_HPP
1.28 +#include <boost/config.hpp>
1.29 +#endif
1.30
1.31 -#include <boost/type_traits/remove_cv.hpp>
1.32 -#include <boost/type_traits/is_empty.hpp>
1.33 -#include <boost/type_traits/is_same.hpp>
1.34 -#include <boost/call_traits.hpp>
1.35 +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
1.36 +#include <boost/detail/ob_compressed_pair.hpp>
1.37 +#else
1.38 +#include <boost/detail/compressed_pair.hpp>
1.39 +#endif
1.40
1.41 -#ifdef BOOST_MSVC
1.42 -# pragma warning(push)
1.43 -# pragma warning(disable:4512)
1.44 -#endif
1.45 -namespace boost
1.46 -{
1.47 -
1.48 -template <class T1, class T2>
1.49 -class compressed_pair;
1.50 -
1.51 -
1.52 -// compressed_pair
1.53 -
1.54 -namespace details
1.55 -{
1.56 - // JM altered 26 Jan 2000:
1.57 - template <class T1, class T2, bool IsSame, bool FirstEmpty, bool SecondEmpty>
1.58 - struct compressed_pair_switch;
1.59 -
1.60 - template <class T1, class T2>
1.61 - struct compressed_pair_switch<T1, T2, false, false, false>
1.62 - {static const int value = 0;};
1.63 -
1.64 - template <class T1, class T2>
1.65 - struct compressed_pair_switch<T1, T2, false, true, true>
1.66 - {static const int value = 3;};
1.67 -
1.68 - template <class T1, class T2>
1.69 - struct compressed_pair_switch<T1, T2, false, true, false>
1.70 - {static const int value = 1;};
1.71 -
1.72 - template <class T1, class T2>
1.73 - struct compressed_pair_switch<T1, T2, false, false, true>
1.74 - {static const int value = 2;};
1.75 -
1.76 - template <class T1, class T2>
1.77 - struct compressed_pair_switch<T1, T2, true, true, true>
1.78 - {static const int value = 4;};
1.79 -
1.80 - template <class T1, class T2>
1.81 - struct compressed_pair_switch<T1, T2, true, false, false>
1.82 - {static const int value = 5;};
1.83 -
1.84 - template <class T1, class T2, int Version> class compressed_pair_imp;
1.85 -
1.86 -#ifdef __GNUC__
1.87 - // workaround for GCC (JM):
1.88 - using std::swap;
1.89 -#endif
1.90 - //
1.91 - // can't call unqualified swap from within classname::swap
1.92 - // as Koenig lookup rules will find only the classname::swap
1.93 - // member function not the global declaration, so use cp_swap
1.94 - // as a forwarding function (JM):
1.95 - template <typename T>
1.96 - inline void cp_swap(T& t1, T& t2)
1.97 - {
1.98 -#ifndef __GNUC__
1.99 - using std::swap;
1.100 -#endif
1.101 - swap(t1, t2);
1.102 - }
1.103 -
1.104 - // 0 derive from neither
1.105 -
1.106 - template <class T1, class T2>
1.107 - class compressed_pair_imp<T1, T2, 0>
1.108 - {
1.109 - public:
1.110 - typedef T1 first_type;
1.111 - typedef T2 second_type;
1.112 - typedef typename call_traits<first_type>::param_type first_param_type;
1.113 - typedef typename call_traits<second_type>::param_type second_param_type;
1.114 - typedef typename call_traits<first_type>::reference first_reference;
1.115 - typedef typename call_traits<second_type>::reference second_reference;
1.116 - typedef typename call_traits<first_type>::const_reference first_const_reference;
1.117 - typedef typename call_traits<second_type>::const_reference second_const_reference;
1.118 -
1.119 - compressed_pair_imp() {}
1.120 -
1.121 - compressed_pair_imp(first_param_type x, second_param_type y)
1.122 - : first_(x), second_(y) {}
1.123 -
1.124 - compressed_pair_imp(first_param_type x)
1.125 - : first_(x) {}
1.126 -
1.127 - compressed_pair_imp(second_param_type y)
1.128 - : second_(y) {}
1.129 -
1.130 - first_reference first() {return first_;}
1.131 - first_const_reference first() const {return first_;}
1.132 -
1.133 - second_reference second() {return second_;}
1.134 - second_const_reference second() const {return second_;}
1.135 -
1.136 - void swap(::boost::compressed_pair<T1, T2>& y)
1.137 - {
1.138 - cp_swap(first_, y.first());
1.139 - cp_swap(second_, y.second());
1.140 - }
1.141 - private:
1.142 - first_type first_;
1.143 - second_type second_;
1.144 - };
1.145 -
1.146 - // 1 derive from T1
1.147 -
1.148 - template <class T1, class T2>
1.149 - class compressed_pair_imp<T1, T2, 1>
1.150 - : protected ::boost::remove_cv<T1>::type
1.151 - {
1.152 - public:
1.153 - typedef T1 first_type;
1.154 - typedef T2 second_type;
1.155 - typedef typename call_traits<first_type>::param_type first_param_type;
1.156 - typedef typename call_traits<second_type>::param_type second_param_type;
1.157 - typedef typename call_traits<first_type>::reference first_reference;
1.158 - typedef typename call_traits<second_type>::reference second_reference;
1.159 - typedef typename call_traits<first_type>::const_reference first_const_reference;
1.160 - typedef typename call_traits<second_type>::const_reference second_const_reference;
1.161 -
1.162 - compressed_pair_imp() {}
1.163 -
1.164 - compressed_pair_imp(first_param_type x, second_param_type y)
1.165 - : first_type(x), second_(y) {}
1.166 -
1.167 - compressed_pair_imp(first_param_type x)
1.168 - : first_type(x) {}
1.169 -
1.170 - compressed_pair_imp(second_param_type y)
1.171 - : second_(y) {}
1.172 -
1.173 - first_reference first() {return *this;}
1.174 - first_const_reference first() const {return *this;}
1.175 -
1.176 - second_reference second() {return second_;}
1.177 - second_const_reference second() const {return second_;}
1.178 -
1.179 - void swap(::boost::compressed_pair<T1,T2>& y)
1.180 - {
1.181 - // no need to swap empty base class:
1.182 - cp_swap(second_, y.second());
1.183 - }
1.184 - private:
1.185 - second_type second_;
1.186 - };
1.187 -
1.188 - // 2 derive from T2
1.189 -
1.190 - template <class T1, class T2>
1.191 - class compressed_pair_imp<T1, T2, 2>
1.192 - : protected ::boost::remove_cv<T2>::type
1.193 - {
1.194 - public:
1.195 - typedef T1 first_type;
1.196 - typedef T2 second_type;
1.197 - typedef typename call_traits<first_type>::param_type first_param_type;
1.198 - typedef typename call_traits<second_type>::param_type second_param_type;
1.199 - typedef typename call_traits<first_type>::reference first_reference;
1.200 - typedef typename call_traits<second_type>::reference second_reference;
1.201 - typedef typename call_traits<first_type>::const_reference first_const_reference;
1.202 - typedef typename call_traits<second_type>::const_reference second_const_reference;
1.203 -
1.204 - compressed_pair_imp() {}
1.205 -
1.206 - compressed_pair_imp(first_param_type x, second_param_type y)
1.207 - : second_type(y), first_(x) {}
1.208 -
1.209 - compressed_pair_imp(first_param_type x)
1.210 - : first_(x) {}
1.211 -
1.212 - compressed_pair_imp(second_param_type y)
1.213 - : second_type(y) {}
1.214 -
1.215 - first_reference first() {return first_;}
1.216 - first_const_reference first() const {return first_;}
1.217 -
1.218 - second_reference second() {return *this;}
1.219 - second_const_reference second() const {return *this;}
1.220 -
1.221 - void swap(::boost::compressed_pair<T1,T2>& y)
1.222 - {
1.223 - // no need to swap empty base class:
1.224 - cp_swap(first_, y.first());
1.225 - }
1.226 -
1.227 - private:
1.228 - first_type first_;
1.229 - };
1.230 -
1.231 - // 3 derive from T1 and T2
1.232 -
1.233 - template <class T1, class T2>
1.234 - class compressed_pair_imp<T1, T2, 3>
1.235 - : protected ::boost::remove_cv<T1>::type,
1.236 - protected ::boost::remove_cv<T2>::type
1.237 - {
1.238 - public:
1.239 - typedef T1 first_type;
1.240 - typedef T2 second_type;
1.241 - typedef typename call_traits<first_type>::param_type first_param_type;
1.242 - typedef typename call_traits<second_type>::param_type second_param_type;
1.243 - typedef typename call_traits<first_type>::reference first_reference;
1.244 - typedef typename call_traits<second_type>::reference second_reference;
1.245 - typedef typename call_traits<first_type>::const_reference first_const_reference;
1.246 - typedef typename call_traits<second_type>::const_reference second_const_reference;
1.247 -
1.248 - compressed_pair_imp() {}
1.249 -
1.250 - compressed_pair_imp(first_param_type x, second_param_type y)
1.251 - : first_type(x), second_type(y) {}
1.252 -
1.253 - compressed_pair_imp(first_param_type x)
1.254 - : first_type(x) {}
1.255 -
1.256 - compressed_pair_imp(second_param_type y)
1.257 - : second_type(y) {}
1.258 -
1.259 - first_reference first() {return *this;}
1.260 - first_const_reference first() const {return *this;}
1.261 -
1.262 - second_reference second() {return *this;}
1.263 - second_const_reference second() const {return *this;}
1.264 - //
1.265 - // no need to swap empty bases:
1.266 - void swap(::boost::compressed_pair<T1,T2>&) {}
1.267 - };
1.268 -
1.269 - // JM
1.270 - // 4 T1 == T2, T1 and T2 both empty
1.271 - // Originally this did not store an instance of T2 at all
1.272 - // but that led to problems beause it meant &x.first() == &x.second()
1.273 - // which is not true for any other kind of pair, so now we store an instance
1.274 - // of T2 just in case the user is relying on first() and second() returning
1.275 - // different objects (albeit both empty).
1.276 - template <class T1, class T2>
1.277 - class compressed_pair_imp<T1, T2, 4>
1.278 - : protected ::boost::remove_cv<T1>::type
1.279 - {
1.280 - public:
1.281 - typedef T1 first_type;
1.282 - typedef T2 second_type;
1.283 - typedef typename call_traits<first_type>::param_type first_param_type;
1.284 - typedef typename call_traits<second_type>::param_type second_param_type;
1.285 - typedef typename call_traits<first_type>::reference first_reference;
1.286 - typedef typename call_traits<second_type>::reference second_reference;
1.287 - typedef typename call_traits<first_type>::const_reference first_const_reference;
1.288 - typedef typename call_traits<second_type>::const_reference second_const_reference;
1.289 -
1.290 - compressed_pair_imp() {}
1.291 -
1.292 - compressed_pair_imp(first_param_type x, second_param_type y)
1.293 - : first_type(x), m_second(y) {}
1.294 -
1.295 - compressed_pair_imp(first_param_type x)
1.296 - : first_type(x), m_second(x) {}
1.297 -
1.298 - first_reference first() {return *this;}
1.299 - first_const_reference first() const {return *this;}
1.300 -
1.301 - second_reference second() {return m_second;}
1.302 - second_const_reference second() const {return m_second;}
1.303 -
1.304 - void swap(::boost::compressed_pair<T1,T2>&) {}
1.305 - private:
1.306 - T2 m_second;
1.307 - };
1.308 -
1.309 - // 5 T1 == T2 and are not empty: //JM
1.310 -
1.311 - template <class T1, class T2>
1.312 - class compressed_pair_imp<T1, T2, 5>
1.313 - {
1.314 - public:
1.315 - typedef T1 first_type;
1.316 - typedef T2 second_type;
1.317 - typedef typename call_traits<first_type>::param_type first_param_type;
1.318 - typedef typename call_traits<second_type>::param_type second_param_type;
1.319 - typedef typename call_traits<first_type>::reference first_reference;
1.320 - typedef typename call_traits<second_type>::reference second_reference;
1.321 - typedef typename call_traits<first_type>::const_reference first_const_reference;
1.322 - typedef typename call_traits<second_type>::const_reference second_const_reference;
1.323 -
1.324 - compressed_pair_imp() {}
1.325 -
1.326 - compressed_pair_imp(first_param_type x, second_param_type y)
1.327 - : first_(x), second_(y) {}
1.328 -
1.329 - compressed_pair_imp(first_param_type x)
1.330 - : first_(x), second_(x) {}
1.331 -
1.332 - first_reference first() {return first_;}
1.333 - first_const_reference first() const {return first_;}
1.334 -
1.335 - second_reference second() {return second_;}
1.336 - second_const_reference second() const {return second_;}
1.337 -
1.338 - void swap(::boost::compressed_pair<T1, T2>& y)
1.339 - {
1.340 - cp_swap(first_, y.first());
1.341 - cp_swap(second_, y.second());
1.342 - }
1.343 - private:
1.344 - first_type first_;
1.345 - second_type second_;
1.346 - };
1.347 -
1.348 -} // details
1.349 -
1.350 -template <class T1, class T2>
1.351 -class compressed_pair
1.352 - : private ::boost::details::compressed_pair_imp<T1, T2,
1.353 - ::boost::details::compressed_pair_switch<
1.354 - T1,
1.355 - T2,
1.356 - ::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value,
1.357 - ::boost::is_empty<T1>::value,
1.358 - ::boost::is_empty<T2>::value>::value>
1.359 -{
1.360 -private:
1.361 - typedef details::compressed_pair_imp<T1, T2,
1.362 - ::boost::details::compressed_pair_switch<
1.363 - T1,
1.364 - T2,
1.365 - ::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value,
1.366 - ::boost::is_empty<T1>::value,
1.367 - ::boost::is_empty<T2>::value>::value> base;
1.368 -public:
1.369 - typedef T1 first_type;
1.370 - typedef T2 second_type;
1.371 - typedef typename call_traits<first_type>::param_type first_param_type;
1.372 - typedef typename call_traits<second_type>::param_type second_param_type;
1.373 - typedef typename call_traits<first_type>::reference first_reference;
1.374 - typedef typename call_traits<second_type>::reference second_reference;
1.375 - typedef typename call_traits<first_type>::const_reference first_const_reference;
1.376 - typedef typename call_traits<second_type>::const_reference second_const_reference;
1.377 -
1.378 - compressed_pair() : base() {}
1.379 - compressed_pair(first_param_type x, second_param_type y) : base(x, y) {}
1.380 - explicit compressed_pair(first_param_type x) : base(x) {}
1.381 - explicit compressed_pair(second_param_type y) : base(y) {}
1.382 -
1.383 - first_reference first() {return base::first();}
1.384 - first_const_reference first() const {return base::first();}
1.385 -
1.386 - second_reference second() {return base::second();}
1.387 - second_const_reference second() const {return base::second();}
1.388 -
1.389 - void swap(compressed_pair& y) { base::swap(y); }
1.390 -};
1.391 -
1.392 -// JM
1.393 -// Partial specialisation for case where T1 == T2:
1.394 -//
1.395 -template <class T>
1.396 -class compressed_pair<T, T>
1.397 - : private details::compressed_pair_imp<T, T,
1.398 - ::boost::details::compressed_pair_switch<
1.399 - T,
1.400 - T,
1.401 - ::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value,
1.402 - ::boost::is_empty<T>::value,
1.403 - ::boost::is_empty<T>::value>::value>
1.404 -{
1.405 -private:
1.406 - typedef details::compressed_pair_imp<T, T,
1.407 - ::boost::details::compressed_pair_switch<
1.408 - T,
1.409 - T,
1.410 - ::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value,
1.411 - ::boost::is_empty<T>::value,
1.412 - ::boost::is_empty<T>::value>::value> base;
1.413 -public:
1.414 - typedef T first_type;
1.415 - typedef T second_type;
1.416 - typedef typename call_traits<first_type>::param_type first_param_type;
1.417 - typedef typename call_traits<second_type>::param_type second_param_type;
1.418 - typedef typename call_traits<first_type>::reference first_reference;
1.419 - typedef typename call_traits<second_type>::reference second_reference;
1.420 - typedef typename call_traits<first_type>::const_reference first_const_reference;
1.421 - typedef typename call_traits<second_type>::const_reference second_const_reference;
1.422 -
1.423 - compressed_pair() : base() {}
1.424 - compressed_pair(first_param_type x, second_param_type y) : base(x, y) {}
1.425 -#if !(defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530))
1.426 - explicit
1.427 -#endif
1.428 - compressed_pair(first_param_type x) : base(x) {}
1.429 -
1.430 - first_reference first() {return base::first();}
1.431 - first_const_reference first() const {return base::first();}
1.432 -
1.433 - second_reference second() {return base::second();}
1.434 - second_const_reference second() const {return base::second();}
1.435 -
1.436 - void swap(::boost::compressed_pair<T,T>& y) { base::swap(y); }
1.437 -};
1.438 -
1.439 -template <class T1, class T2>
1.440 -inline
1.441 -void
1.442 -swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y)
1.443 -{
1.444 - x.swap(y);
1.445 -}
1.446 -
1.447 -} // boost
1.448 -
1.449 -#ifdef BOOST_MSVC
1.450 -# pragma warning(pop)
1.451 -#endif
1.452 -
1.453 -#endif // BOOST_DETAIL_COMPRESSED_PAIR_HPP
1.454 -
1.455 +#endif // BOOST_COMPRESSED_PAIR_HPP