Switch to use of BOOST_STATIC_CONSTANT where possible

[SVN r9127]
This commit is contained in:
Dave Abrahams
2001-02-11 19:29:28 +00:00
parent ea4c7c7dd9
commit e3aaf2cc91

View File

@ -12,6 +12,8 @@
// //
// Revision History: // Revision History:
// 11 Feb 2001 David Abrahams
// Switch to use of BOOST_STATIC_CONSTANT where possible
// 11 Feb 2001 Jeremy Siek // 11 Feb 2001 Jeremy Siek
// Removed workaround for older MIPSpro compiler. The workaround // Removed workaround for older MIPSpro compiler. The workaround
// was preventing the proper functionality of the underlying // was preventing the proper functionality of the underlying
@ -338,8 +340,11 @@ namespace detail {
{ {
typedef operator_arrow_proxy<Value> proxy; typedef operator_arrow_proxy<Value> proxy;
enum { is_input_iter = boost::is_convertible<Category,std::input_iterator_tag>::value // Borland chokes unless it's an actual enum (!)
& !boost::is_convertible<Category,std::forward_iterator_tag>::value }; enum { is_input_iter
= (boost::is_convertible<Category*,std::input_iterator_tag*>::value
& !boost::is_convertible<Category*,std::forward_iterator_tag*>::value)
};
typedef typename boost::detail::if_true<(is_input_iter)>::template typedef typename boost::detail::if_true<(is_input_iter)>::template
then< then<
@ -385,7 +390,7 @@ namespace detail {
template <class Iterator,class Value> template <class Iterator,class Value>
struct iterator_defaults struct iterator_defaults
{ {
enum { is_ptr = boost::is_pointer<Iterator>::value }; BOOST_STATIC_CONSTANT(bool, is_ptr = boost::is_pointer<Iterator>::value);
typedef iterator_defaults_select<is_ptr>::template traits<Iterator,Value> traits; typedef iterator_defaults_select<is_ptr>::template traits<Iterator,Value> traits;
typedef typename traits::pointer pointer; typedef typename traits::pointer pointer;
@ -470,7 +475,7 @@ struct iterator_adaptor :
#endif #endif
{ {
typedef iterator_adaptor<Base,Policies,Value,Reference,Pointer,Category,Distance> self; typedef iterator_adaptor<Base,Policies,Value,Reference,Pointer,Category,Distance> self;
public: public:
typedef Distance difference_type; typedef Distance difference_type;
typedef typename boost::remove_const<Value>::type value_type; typedef typename boost::remove_const<Value>::type value_type;
typedef Pointer pointer; typedef Pointer pointer;
@ -478,20 +483,23 @@ public:
typedef Category iterator_category; typedef Category iterator_category;
typedef Base base_type; typedef Base base_type;
enum { is_input_or_output_iter = private:
boost::is_convertible<iterator_category*,std::input_iterator_tag*>::value BOOST_STATIC_CONSTANT(bool, is_input_or_output_iter
|| boost::is_convertible<iterator_category*,std::output_iterator_tag*>::value }; = (boost::is_convertible<iterator_category*,std::input_iterator_tag*>::value
|| boost::is_convertible<iterator_category*,std::output_iterator_tag*>::value));
// Iterators should satisfy one of the known categories // Iterators should satisfy one of the known categories
BOOST_STATIC_ASSERT(is_input_or_output_iter); BOOST_STATIC_ASSERT(is_input_or_output_iter);
// Iterators >= ForwardIterator must produce real references. // Iterators >= ForwardIterator must produce real references.
enum { forward_iter_with_real_reference = BOOST_STATIC_CONSTANT(bool, forward_iter_with_real_reference =
(!boost::is_convertible<iterator_category*,std::forward_iterator_tag*>::value (!boost::is_convertible<iterator_category*,std::forward_iterator_tag*>::value
|| boost::is_same<reference,value_type&>::value || boost::is_same<reference,value_type&>::value
|| boost::is_same<reference,const value_type&>::value) }; || boost::is_same<reference,const value_type&>::value));
BOOST_STATIC_ASSERT(forward_iter_with_real_reference); BOOST_STATIC_ASSERT(forward_iter_with_real_reference);
public:
iterator_adaptor() { } iterator_adaptor() { }
iterator_adaptor(const Base& it, const Policies& p = Policies()) iterator_adaptor(const Base& it, const Policies& p = Policies())
@ -976,7 +984,9 @@ namespace detail {
>::type type; >::type type;
private: private:
// For some reason, putting this assertion in filter_iterator_generator fails inexplicably under MSVC // For some reason, putting this assertion in filter_iterator_generator fails inexplicably under MSVC
enum { is_bidirectional = (!boost::is_convertible<type*, std::bidirectional_iterator_tag*>::value) }; BOOST_STATIC_CONSTANT(
bool, is_bidirectional
= (!boost::is_convertible<type*, std::bidirectional_iterator_tag*>::value));
BOOST_STATIC_ASSERT(is_bidirectional); BOOST_STATIC_ASSERT(is_bidirectional);
# else # else
// is_convertible doesn't work with MWERKS // is_convertible doesn't work with MWERKS
@ -1000,17 +1010,8 @@ template <class Predicate, class Iterator,
class Distance = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<Iterator>::difference_type class Distance = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<Iterator>::difference_type
> >
class filter_iterator_generator { class filter_iterator_generator {
#ifndef __BORLANDC__ BOOST_STATIC_CONSTANT(bool, is_bidirectional
enum { = (boost::is_convertible<Category*, std::bidirectional_iterator_tag*>::value));
#else
static const bool
#endif
is_bidirectional
= boost::is_convertible<Category*, std::bidirectional_iterator_tag*>::value
#ifndef __BORLANDC__
}
#endif
;
#ifndef BOOST_MSVC // I don't have any idea why this occurs, but it doesn't seem to hurt too badly. #ifndef BOOST_MSVC // I don't have any idea why this occurs, but it doesn't seem to hurt too badly.
BOOST_STATIC_ASSERT(!is_bidirectional); BOOST_STATIC_ASSERT(!is_bidirectional);
#endif #endif