From 775d25573bac4b009dd393db12eaeb5a8e8e1130 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Sun, 25 Nov 2007 18:07:19 +0000 Subject: [PATCH] Full merge from trunk at revision 41356 of entire boost-root tree. [SVN r41369] --- include/boost/pending/ct_if.hpp | 104 +++++-------------------- include/boost/pending/integer_log2.hpp | 9 ++- 2 files changed, 24 insertions(+), 89 deletions(-) diff --git a/include/boost/pending/ct_if.hpp b/include/boost/pending/ct_if.hpp index 2f8540d..a9b801e 100644 --- a/include/boost/pending/ct_if.hpp +++ b/include/boost/pending/ct_if.hpp @@ -3,107 +3,39 @@ // 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. +// This header replaces the implementation of ct_if that preceded the +// introduction of Boost.MPL with a facade that defers to that reviewed and +// accepted library. + +// Author: Ronald Garcia +// Date: 20 October, 2006 + #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. -*/ +// A stub implementation in terms of Boost.MPL -#include // true_type and false_type +#include +#include +#include +// true_type and false_type are used by applications of ct_if +#include namespace boost { - struct ct_if_error { }; - template - struct ct_and { typedef false_type type; }; - template <> struct ct_and { typedef true_type type; }; + struct ct_and : boost::mpl::and_ {}; - 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; }; + template + struct ct_not : mpl::not_ {}; -#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 + struct ct_if : mpl::if_c {}; 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 + struct ct_if_t : mpl::if_ {}; } // namespace boost diff --git a/include/boost/pending/integer_log2.hpp b/include/boost/pending/integer_log2.hpp index fd8e446..15fd8b5 100644 --- a/include/boost/pending/integer_log2.hpp +++ b/include/boost/pending/integer_log2.hpp @@ -12,14 +12,17 @@ // http://www.boost.org/LICENSE_1_0.txt) // // ------------------------------------------------------ - +// +// $Id$ #ifndef BOOST_INTEGER_LOG2_HPP_GP_20030301 #define BOOST_INTEGER_LOG2_HPP_GP_20030301 -#include -#include // actually used for Borland only +#include +#ifdef __BORLANDC__ +#include +#endif #include "boost/limits.hpp" #include "boost/config.hpp"