diff -r 666f914201fb -r 2fe1408b6811 epoc32/include/stdapis/boost/pending/ct_if.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/epoc32/include/stdapis/boost/pending/ct_if.hpp Tue Mar 16 16:12:26 2010 +0000 @@ -0,0 +1,111 @@ +// (C) Copyright Jeremy Siek 2000. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// The ct_if implementation that avoids partial specialization is +// based on the IF class by Ulrich W. Eisenecker and Krzysztof +// Czarnecki. + +#ifndef BOOST_CT_IF_HPP +#define BOOST_CT_IF_HPP + +#include + +/* + There is a bug in the Borland compiler with regards to using + integers to specialize templates. This made it hard to use ct_if in + the graph library. Changing from 'ct_if' to 'ct_if_t' fixed the + problem. +*/ + +#include // true_type and false_type + +namespace boost { + + struct ct_if_error { }; + + template + struct ct_and { typedef false_type type; }; + template <> struct ct_and { typedef true_type type; }; + + template struct ct_not { typedef ct_if_error type; }; + template <> struct ct_not { typedef false_type type; }; + template <> struct ct_not { typedef true_type type; }; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +// agurt, 15/sep/02: in certain cases Borland has problems with +// choosing the right 'ct_if' specialization even though 'cond' +// _does_ equal '1'; the easiest way to fix it is to make first +// 'ct_if' non-type template parameter boolean. +#if !defined(__BORLANDC__) + template + struct ct_if { typedef ct_if_error type; }; + template + struct ct_if { typedef A type; }; + template + struct ct_if { typedef B type; }; +#else + template + struct ct_if { typedef A type; }; + template + struct ct_if { typedef B type; }; +#endif + + template + struct ct_if_t { typedef ct_if_error type; }; + template + struct ct_if_t { typedef A type; }; + template + struct ct_if_t { typedef B type; }; + +#else + + namespace detail { + + template struct IF; + template struct SlectSelector; + struct SelectFirstType; + struct SelectSecondType; + + struct SelectFirstType { + template + struct Template { typedef A type; }; + }; + + struct SelectSecondType { + template + struct Template { typedef B type; }; + }; + + template + struct SlectSelector { + typedef SelectFirstType type; + }; + + template <> + struct SlectSelector<0> { + typedef SelectSecondType type; + }; + + } // namespace detail + + template + struct ct_if + { + typedef typename detail::SlectSelector::type Selector; + typedef typename Selector::template Template::type type; + }; + + template + struct ct_if_t { + typedef typename ct_if::type type; + }; + +#endif + +} // namespace boost + +#endif // BOOST_CT_IF_HPP +