Borland fixes up the wazoo. It finally works!

[SVN r9114]
This commit is contained in:
Dave Abrahams
2001-02-11 16:09:22 +00:00
parent 268e70faa1
commit fd6ba58d5e

View File

@ -12,6 +12,8 @@
// //
// Revision History: // Revision History:
// 11 Feb 2001 David Abrahams
// Borland fixes up the wazoo. It finally works!
// 10 Feb 2001 David Abrahams // 10 Feb 2001 David Abrahams
// Removed traits argument from iterator_adaptor<> and switched to // Removed traits argument from iterator_adaptor<> and switched to
// explicit trait specification for maximum ease-of-use. // explicit trait specification for maximum ease-of-use.
@ -22,70 +24,52 @@
// 10 Feb 2001 David Abrahams // 10 Feb 2001 David Abrahams
// Rolled in supposed Borland fixes from John Maddock, but not seeing any // Rolled in supposed Borland fixes from John Maddock, but not seeing any
// improvement yet // improvement yet
//
// Changed argument order to indirect_ generator, for convenience in the // Changed argument order to indirect_ generator, for convenience in the
// case of input iterators (where Reference must be a value type). // case of input iterators (where Reference must be a value type).
//
// Removed derivation of filter_iterator_policies from // Removed derivation of filter_iterator_policies from
// default_iterator_policies, since the iterator category is likely to be // default_iterator_policies, since the iterator category is likely to be
// reduced (we don't want to allow illegal operations like decrement). // reduced (we don't want to allow illegal operations like decrement).
//
// Support for a simpler filter iterator interface. // Support for a simpler filter iterator interface.
// //
// 09 Feb 2001 David Abrahams // 09 Feb 2001 David Abrahams
// Improved interface to indirect_ and reverse_ iterators // Improved interface to indirect_ and reverse_ iterators
//
// Rolled back Jeremy's new constructor for now; it was causing // Rolled back Jeremy's new constructor for now; it was causing
// problems with counting_iterator_test // problems with counting_iterator_test
//
// Attempted fix for Borland // Attempted fix for Borland
// //
// 09 Feb 2001 Jeremy Siek // 09 Feb 2001 Jeremy Siek
// Added iterator constructor to allow const adaptor // Added iterator constructor to allow const adaptor
// from non-const adaptee. // from non-const adaptee.
//
// Changed make_xxx to pass iterators by-value to // Changed make_xxx to pass iterators by-value to
// get arrays converted to pointers. // get arrays converted to pointers.
//
// Removed InnerIterator template parameter from // Removed InnerIterator template parameter from
// indirect_iterator_generator. // indirect_iterator_generator.
//
// Rearranged parameters for make_filter_iterator // Rearranged parameters for make_filter_iterator
// //
// 07 Feb 2001 Jeremy Siek // 07 Feb 2001 Jeremy Siek
// Removed some const iterator adaptor generators. // Removed some const iterator adaptor generators.
//
// Added make_xxx_iterator() helper functions for remaining // Added make_xxx_iterator() helper functions for remaining
// iterator adaptors. // iterator adaptors.
//
// Removed some traits template parameters where they // Removed some traits template parameters where they
// where no longer needed thanks to detail::iterator_traits. // where no longer needed thanks to detail::iterator_traits.
//
// Moved some of the compile-time logic into enums for // Moved some of the compile-time logic into enums for
// EDG compatibility. // EDG compatibility.
// //
// 07 Feb 2001 David Abrahams // 07 Feb 2001 David Abrahams
// Removed iterator_adaptor_pair_generator and // Removed iterator_adaptor_pair_generator and
// reverse_iterator_pair_generator (more such culling to come) // reverse_iterator_pair_generator (more such culling to come)
//
// Improved comments // Improved comments
//
// Changed all uses of std::iterator_traits as default arguments // Changed all uses of std::iterator_traits as default arguments
// to boost::detail::iterator_traits for improved utility in // to boost::detail::iterator_traits for improved utility in
// non-generic contexts // non-generic contexts
//
// Fixed naming convention of non-template parameter names // Fixed naming convention of non-template parameter names
// //
// 06 Feb 2001 David Abrahams // 06 Feb 2001 David Abrahams
// Produce operator-> proxy objects for InputIterators // Produce operator-> proxy objects for InputIterators
//
// Added static assertions to do some basic concept checks // Added static assertions to do some basic concept checks
//
// Renamed single-type generators -> xxx_generator // Renamed single-type generators -> xxx_generator
// Renamed const/nonconst iterator generators -> xxx_pair_generator // Renamed const/nonconst iterator generators -> xxx_pair_generator
//
// Added make_transform_iterator(iter, function) // Added make_transform_iterator(iter, function)
//
// The existence of boost::detail::iterator_traits allowed many // The existence of boost::detail::iterator_traits allowed many
// template arguments to be defaulted. Some arguments had to be // template arguments to be defaulted. Some arguments had to be
// moved to accomplish it. // moved to accomplish it.
@ -358,7 +342,11 @@ namespace detail {
template <class Iter> template <class Iter>
inline operator_arrow_proxy<typename Iter::value_type> inline operator_arrow_proxy<typename Iter::value_type>
operator_arrow(const Iter& i, std::input_iterator_tag) { operator_arrow(const Iter& i, std::input_iterator_tag) {
return operator_arrow_proxy<typename Iter::value_type>(*i); return operator_arrow_proxy<
#ifndef BOOST_MSVC
typename
#endif
Iter::value_type>(*i);
} }
template <class Iter> template <class Iter>
@ -431,6 +419,7 @@ namespace detail {
struct iterator_defaults struct iterator_defaults
{ {
enum { is_ptr = boost::is_pointer<Iterator>::value }; enum { 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;
typedef typename traits::reference reference; typedef typename traits::reference reference;
@ -439,20 +428,17 @@ namespace detail {
template <class Iterator,class Value> template <class Iterator,class Value>
struct iterator_defaults : iterator_traits<Iterator> struct iterator_defaults : iterator_traits<Iterator>
{ {
enum { // Trying to factor the common is_same expression into an enum or a
is_iterator_value_type = // static bool constant confused Borland.
::boost::is_same<Value,typename iterator_traits<Iterator>::value_type>::value
};
typedef typename if_true<( typedef typename if_true<(
is_iterator_value_type ::boost::is_same<Value,typename iterator_traits<Iterator>::value_type>::value
)>::template then< )>::template then<
typename iterator_traits<Iterator>::pointer, typename iterator_traits<Iterator>::pointer,
Value* Value*
>::type pointer; >::type pointer;
typedef typename if_true<( typedef typename if_true<(
is_iterator_value_type ::boost::is_same<Value,typename iterator_traits<Iterator>::value_type>::value
)>::template then< )>::template then<
typename iterator_traits<Iterator>::reference, typename iterator_traits<Iterator>::reference,
Value& Value&
@ -1046,10 +1032,17 @@ 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__
enum { enum {
#else
static const bool
#endif
is_bidirectional is_bidirectional
= boost::is_convertible<Category*, std::bidirectional_iterator_tag*>::value = 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