fixes for VC6-7.0

[SVN r28876]
This commit is contained in:
Jonathan Turkanis
2005-05-13 15:45:53 +00:00
parent c5d1b4a62a
commit d77dbb2d0b
7 changed files with 76 additions and 74 deletions

View File

@ -11,8 +11,13 @@
#ifndef BOOST_RANGE_DETAIL_BEGIN_HPP
#define BOOST_RANGE_DETAIL_BEGIN_HPP
#include <boost/config.hpp> // BOOST_MSVC
#include <boost/detail/workaround.hpp>
#include <boost/range/result_iterator.hpp>
#include <boost/range/detail/common.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, < 1310)
# include <boost/range/value_type.hpp>
#endif
namespace boost
{
@ -57,11 +62,19 @@ namespace boost
template<>
struct range_begin<array_>
{
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310)
template< typename T, std::size_t sz >
static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] )
{
return boost_range_array;
}
#else
template<typename T>
static BOOST_RANGE_DEDUCED_TYPENAME range_value<T>::type* fun(T& t)
{
return t;
}
#endif
};
//////////////////////////////////////////////////////////////////////
@ -108,10 +121,10 @@ namespace boost
} // namespace 'range_detail'
template< typename C >
inline BOOST_DEDUCED_TYPENAME range_result_iterator<C>::type
inline BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator<C>::type
begin( C& c )
{
return range_detail::range_begin< BOOST_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c );
return range_detail::range_begin< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c );
}
} // namespace 'boost'

View File

@ -12,7 +12,7 @@
#define BOOST_RANGE_DETAIL_CONST_ITERATOR_HPP
#include <boost/range/detail/common.hpp>
#include <boost/type_traits/remove_bounds.hpp>
#include <boost/range/detail/remove_extent.hpp>
//////////////////////////////////////////////////////////////////////////////
// missing partial specialization workaround.
@ -31,7 +31,7 @@ namespace boost
template< typename C >
struct pts
{
typedef BOOST_DEDUCED_TYPENAME C::const_iterator type;
typedef BOOST_RANGE_DEDUCED_TYPENAME C::const_iterator type;
};
};
@ -41,7 +41,7 @@ namespace boost
template< typename P >
struct pts
{
typedef BOOST_DEDUCED_TYPENAME P::first_type type;
typedef BOOST_RANGE_DEDUCED_TYPENAME P::first_type type;
};
};
@ -53,7 +53,7 @@ namespace boost
struct pts
{
typedef const BOOST_RANGE_DEDUCED_TYPENAME
remove_bounds<T>::type* type;
remove_extent<T>::type* type;
};
};
@ -64,7 +64,7 @@ namespace boost
struct pts
{
typedef const BOOST_RANGE_DEDUCED_TYPENAME
remove_bounds<T>::type* type;
remove_extent<T>::type* type;
};
};

View File

@ -11,9 +11,19 @@
#ifndef BOOST_RANGE_DETAIL_END_HPP
#define BOOST_RANGE_DETAIL_END_HPP
#include <boost/range/detail/implementation_help.hpp>
#include <boost/range/result_iterator.hpp>
#include <boost/range/detail/common.hpp>
#include <boost/config.hpp> // BOOST_MSVC
#include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
# include <boost/range/detail/vc6/end.hpp>
#else
# include <boost/range/detail/implementation_help.hpp>
# include <boost/range/detail/implementation_help.hpp>
# include <boost/range/result_iterator.hpp>
# include <boost/range/detail/common.hpp>
# if BOOST_WORKAROUND(BOOST_MSVC, < 1310)
# include <boost/range/detail/remove_extent.hpp>
# endif
namespace boost
{
@ -59,11 +69,19 @@ namespace boost
template<>
struct range_end<array_>
{
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310)
template< typename T, std::size_t sz >
static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] )
{
return boost::range_detail::array_end( boost_range_array );
}
#else
template<typename T>
static BOOST_RANGE_DEDUCED_TYPENAME remove_extent<T>::type* fun(T& t)
{
return t + remove_extent<T>::size;
}
#endif
};
@ -131,13 +149,13 @@ namespace boost
} // namespace 'range_detail'
template< typename C >
inline BOOST_DEDUCED_TYPENAME range_result_iterator<C>::type
inline BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator<C>::type
end( C& c )
{
return range_detail::range_end< BOOST_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c );
return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c );
}
} // namespace 'boost'
# endif // VC6
#endif

View File

@ -12,10 +12,18 @@
#ifndef BOOST_RANGE_DETAIL_SIZE_HPP
#define BOOST_RANGE_DETAIL_SIZE_HPP
#include <boost/range/detail/implementation_help.hpp>
#include <boost/range/detail/size_type.hpp>
#include <boost/range/detail/common.hpp>
#include <iterator>
#include <boost/config.hpp> // BOOST_MSVC
#include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
# include <boost/range/detail/vc6/size.hpp>
#else
# include <boost/range/detail/implementation_help.hpp>
# include <boost/range/detail/size_type.hpp>
# include <boost/range/detail/common.hpp>
# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
# include <boost/range/detail/remove_extent.hpp>
# endif
# include <iterator>
namespace boost
{
@ -60,11 +68,19 @@ namespace boost
template<>
struct range_size_<array_>
{
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
template< typename T, std::size_t sz >
static std::size_t fun( T BOOST_RANGE_ARRAY_REF()[sz] )
{
return sz;
}
#else
template<typename T>
static std::size_t fun(T& t)
{
return remove_extent<T>::size;
}
#endif
};
template<>
@ -139,5 +155,5 @@ namespace boost
} // namespace 'boost'
# endif
#endif

View File

@ -30,7 +30,7 @@ namespace boost
template< typename C >
struct pts
{
typedef BOOST_DEDUCED_TYPENAME C::size_type type;
typedef BOOST_RANGE_DEDUCED_TYPENAME C::size_type type;
};
};
@ -108,9 +108,9 @@ namespace boost
template< typename C >
class range_size
{
typedef BOOST_DEDUCED_TYPENAME range_detail::range<C>::type c_type;
typedef typename range_detail::range<C>::type c_type;
public:
typedef BOOST_DEDUCED_TYPENAME range_detail::range_size_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
typedef typename range_detail::range_size_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
};
}

View File

@ -12,7 +12,7 @@
#define BOOST_RANGE_DETAIL_VALUE_TYPE_HPP
#include <boost/range/detail/common.hpp>
#include <boost/type_traits/remove_bounds.hpp>
#include <boost/range/detail/remove_extent.hpp>
#include <boost/iterator/iterator_traits.hpp>
//////////////////////////////////////////////////////////////////////////////
@ -32,7 +32,7 @@ namespace boost
template< typename C >
struct pts
{
typedef BOOST_DEDUCED_TYPENAME C::value_type type;
typedef BOOST_RANGE_DEDUCED_TYPENAME C::value_type type;
};
};
@ -42,7 +42,7 @@ namespace boost
template< typename P >
struct pts
{
typedef BOOST_DEDUCED_TYPENAME boost::iterator_value< BOOST_RANGE_DEDUCED_TYPENAME P::first_type >::type type;
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::iterator_value< BOOST_RANGE_DEDUCED_TYPENAME P::first_type >::type type;
};
};
@ -52,7 +52,7 @@ namespace boost
template< typename T >
struct pts
{
typedef BOOST_DEDUCED_TYPENAME boost::remove_bounds<T>::type type;
typedef BOOST_DEDUCED_TYPENAME remove_extent<T>::type type;
};
};

View File

@ -25,15 +25,6 @@ namespace boost
template< typename T >
struct range_size_;
struct range_size_std_container_
{
template< typename C >
static BOOST_RANGE_DEDUCED_TYPENAME C::size_type fun( const C& c )
{
return c.size();
};
};
//////////////////////////////////////////////////////////////////////
// default
//////////////////////////////////////////////////////////////////////
@ -45,7 +36,7 @@ namespace boost
struct inner {
static BOOST_RANGE_DEDUCED_TYPENAME C::size_type fun( const C& c )
{
return range_size_std_container_::fun(c.size());
return c.size();
};
};
};
@ -54,15 +45,6 @@ namespace boost
// pair
//////////////////////////////////////////////////////////////////////
struct range_size_std_pair_ {
template< typename P >
static BOOST_RANGE_DEDUCED_TYPENAME range_size<P>::type
fun( const P& p )
{
return std::distance( p.first, p.second );
}
};
template<>
struct range_size_<std_pair_>
{
@ -71,7 +53,7 @@ namespace boost
static BOOST_RANGE_DEDUCED_TYPENAME range_size<P>::type
fun( const P& p )
{
return range_size_std_pair_::fun( p );
return std::distance( p.first, p.second );
}
};
};
@ -79,15 +61,6 @@ namespace boost
//////////////////////////////////////////////////////////////////////
// array
//////////////////////////////////////////////////////////////////////
struct range_size_array_
{
template<typename T>
static std::size_t fun(T& t)
{
return remove_extent<T>::size;
}
};
template<>
struct range_size_<array_>
@ -101,15 +74,6 @@ namespace boost
};
};
struct range_size_char_array_
{
template<typename T>
static std::size_t fun(T& t)
{
return sizeof(T) / sizeof(T[0]);
}
};
template<>
struct range_size_<char_array_>
{
@ -117,20 +81,11 @@ namespace boost
struct inner {
static std::size_t fun(T& t)
{
range_size_char_array_::fun(t);
return sizeof(T) / sizeof(T[0]);
}
};
};
struct range_size_wchar_t_array_
{
template<typename T>
static std::size_t fun(T& t)
{
return sizeof(T) / sizeof(T[0]);
}
};
template<>
struct range_size_<wchar_t_array_>
{
@ -138,7 +93,7 @@ namespace boost
struct inner {
static std::size_t fun(T& t)
{
range_size_wchar_t_array_::fun(t);
return sizeof(T) / sizeof(T[0]);
}
};
};