From: John Maddock (John_Maddock_at_[hidden])
Date: 2001-02-07 06:47:09
>The fact is, I'm pretty sure we could do this with Borland, despite its
>of support for non-type template argument support. Instead of bool values
>true and false, we'd use distinct types true_t and false_t. It would
>require... well, a lot of changes, especially to type_traits. Also, of
>course, we couldn't use operators such as && and ! as above - we'd have to
>replace them with templates.
Can I just point out that non-type template parameters are definately not
broken on Borlands compiler. However there are a couple of gotchas:
1) You can't use non-type template parameters, that have dependent default
template <class T, bool b = something<T>::value>
2) is_convertible is partly broken on C++ Builder - it can't handle
constructor based conversions (or at least it doesn't recognise them as
integral constant expressions), in this case use either pointer or
reference conversions instead.
3) There are problem handling integral constant expressions, in particular
you must refer to integral constant expressions by their fully qualified
names, otherwise they are not recognised as such (I've sporadically had
this problem with VC6 as well). So use:
Also look at the new type traits stuff, there is some integral constant
expression stuff in there that I havn't got around to documenting yet - see
boost/type_traits/ice.hpp - these are used extensively inside the new type
traits code, where all logical operators have been abolished. Maybe this
shouls be moved out of the type_traits library into it's own "top level"
header, I'm not sure.
When I've time I want to put together all the gotcha's I've found so far in
a set of coding rules for integral constant expressions.
- John Maddock
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk