From 304cce63f590842090505c357500badf10ce1d6a Mon Sep 17 00:00:00 2001 From: Jeremy Siek Date: Tue, 17 Oct 2000 00:16:05 +0000 Subject: [PATCH] ported the graph library to borland [SVN r7965] --- include/boost/pending/ct_if.hpp | 36 ++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/include/boost/pending/ct_if.hpp b/include/boost/pending/ct_if.hpp index 669ad54..1655cfa 100644 --- a/include/boost/pending/ct_if.hpp +++ b/include/boost/pending/ct_if.hpp @@ -12,15 +12,44 @@ #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. +*/ + namespace boost { + struct ct_if_error { }; + + struct true_type { enum { value = true }; }; + struct false_type { enum { value = false }; }; + + 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 template - struct ct_if { typedef A type; }; + struct ct_if { typedef ct_if_error type; }; + template + struct ct_if<1, A, B> { typedef A type; }; template struct ct_if<0, A, B> { typedef B type; }; + 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 { @@ -59,6 +88,11 @@ namespace boost { typedef typename Selector::template Template::type type; }; + template + struct ct_if_t { + typedef typename ct_if::type type; + }; + #endif } // namespace boost