Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-02-06 17:45:40


I've been doing things in boost recently which require lots of compile-time
type inference. Here's an example:

    detail::select_type<(
          is_convertible<iterator_category,std::input_iterator_tag>::value
          &&
!is_convertible<iterator_category,std::forward_iterator_tag>::value),
        detail::operator_arrow_proxy<value_type>,
        pointer>::type
   operator->() const
      {...}

What does this do? It selects a special return type for the arrow operator
of input iterators, in order to stay strictly in conformance with the
standard's requirements. The details, however, are unimportant.

The fact is, I'm pretty sure we could do this with Borland, despite its lack
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.

Personally I don't think it's worth it, but maybe our Borland users think
differently and would like to attack the problem? The thing is, this kind of
usage is showing up more and more in many of our libraries, which I guess is
going to break them with respect to BCC.

-Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk