Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2003-06-23 04:11:54


Hi,

Here's some code for the validator class, in iterator_adaptors.hpp:

// line 741
  // This is really a partial concept check for iterators. Should it
  // be moved or done differently?
  template <class Category, class Value, class Difference, class Pointer,
class Reference>
  struct validator
  {
      BOOST_STATIC_CONSTANT(
          bool, is_input_or_output_iter
          =
(boost::is_convertible<Category*,std::input_iterator_tag*>::value
             |
boost::is_convertible<Category*,std::output_iterator_tag*>::value));

      // Iterators should satisfy one of the known categories
      BOOST_STATIC_ASSERT(is_input_or_output_iter);

      // Iterators >= ForwardIterator must produce real references
      // as required by the C++ standard requirements in Table 74.
      BOOST_STATIC_CONSTANT(
          bool, forward_iter_with_real_reference
          =
((!boost::is_convertible<Category*,std::forward_iterator_tag*>::value)
             | boost::is_same<Reference,Value&>::value
             | boost::is_same<Reference,typename
add_const<Value>::type&>::value));

      BOOST_STATIC_ASSERT(forward_iter_with_real_reference);
  };

When creating the STATIC_CONSTANTs, was "|" what was meant, or was "||"
meant to be there, like this:
      BOOST_STATIC_CONSTANT(
          bool, is_input_or_output_iter
          =
(boost::is_convertible<Category*,std::input_iterator_tag*>::value
             ||
boost::is_convertible<Category*,std::output_iterator_tag*>::value));

...etc.

Best,
John

--
John Torjo
-- "Practical C++" column writer for builder.com.com
Freelancer, C++ consultant
mailto:john_at_[hidden]

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