From ee352dee03d6cb77108180833e3097a9d7bd27c5 Mon Sep 17 00:00:00 2001 From: Jeremy Siek Date: Mon, 18 Sep 2000 08:24:47 +0000 Subject: [PATCH] pending stuff from Boost Graph Library [SVN r7704] --- include/boost/pending/cstddef.hpp | 12 ++++++ include/boost/pending/ct_if.hpp | 67 +++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 include/boost/pending/cstddef.hpp create mode 100644 include/boost/pending/ct_if.hpp diff --git a/include/boost/pending/cstddef.hpp b/include/boost/pending/cstddef.hpp new file mode 100644 index 0000000..279bec0 --- /dev/null +++ b/include/boost/pending/cstddef.hpp @@ -0,0 +1,12 @@ +// -*- C++ -*- forwarding header. + +#ifndef BOOST_CSTDDEF_HPP +#define BOOST_CSTDDEF_HPP + +#if defined(__sgi) && !defined(__GNUC__) +# include +#else +# include +#endif + +#endif diff --git a/include/boost/pending/ct_if.hpp b/include/boost/pending/ct_if.hpp new file mode 100644 index 0000000..a6f3059 --- /dev/null +++ b/include/boost/pending/ct_if.hpp @@ -0,0 +1,67 @@ +// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// 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 + +namespace boost { + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + template + struct ct_if { typedef A type; }; + template + struct ct_if<0, A, B> { 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; + }; + +#endif + +} // namespace boost + +#endif // BOOST_CT_IF_HPP +