merge branch develop

This commit is contained in:
Neil Groves
2014-03-04 13:51:43 +00:00
59 changed files with 3156 additions and 1376 deletions

View File

@ -27,25 +27,40 @@ namespace boost
{
typedef typename mpl::if_<
typename is_reference<T>::type,
typename add_reference<
typename add_const<
typename remove_reference<T>::type
>::type
>::type,
typename add_const<
typename remove_reference<T>::type
>::type&,
T
>::type type;
};
template<class T>
struct mutable_reference_type_generator
{
typedef typename mpl::if_<
typename mpl::and_<
typename is_const<T>::type,
typename mpl::not_<typename is_reference<T>::type>::type
>::type,
T,
typename add_reference<T>::type
>::type type;
};
template<
class Reference
, class Buffer
>
struct any_incrementable_iterator_interface
{
typedef Reference reference;
typedef typename mutable_reference_type_generator<
Reference
>::type reference;
typedef typename const_reference_type_generator<
Reference
>::type const_reference;
typedef typename remove_const<
typename remove_reference<Reference>::type
>::type reference_as_value_type;
@ -87,7 +102,7 @@ namespace boost
virtual any_single_pass_iterator_interface<reference_as_value_type, Buffer>*
clone_reference_as_value(buffer_type& buffer) const = 0;
virtual Reference dereference() const = 0;
virtual reference dereference() const = 0;
virtual bool equal(const any_single_pass_iterator_interface& other) const = 0;
};

View File

@ -19,6 +19,17 @@ namespace boost
{
namespace range_detail
{
template<class Reference, class T>
Reference dereference_cast(T& x)
{
return static_cast<Reference>(x);
}
template<class Reference, class T>
Reference dereference_cast(const T& x)
{
return static_cast<Reference>(const_cast<T&>(x));
}
template<
class WrappedIterator
, class Reference
@ -114,7 +125,13 @@ namespace boost
{
struct disabler {};
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassIteratorConcept<WrappedIterator> ));
typedef any_single_pass_iterator_interface<
Reference,
Buffer
> base_type;
public:
typedef typename base_type::reference reference;
any_single_pass_iterator_wrapper()
: m_it()
@ -178,9 +195,9 @@ namespace boost
return m_it == boost::polymorphic_downcast<const any_single_pass_iterator_wrapper*>(&other)->m_it;
}
virtual Reference dereference() const
virtual reference dereference() const
{
return *m_it;
return dereference_cast<reference>(*m_it);
}
private:
@ -199,7 +216,14 @@ namespace boost
>
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardIteratorConcept<WrappedIterator> ));
typedef any_forward_iterator_interface<
Reference,
Buffer
> base_type;
public:
typedef typename base_type::reference reference;
any_forward_iterator_wrapper()
: m_it()
{}
@ -263,9 +287,9 @@ namespace boost
return m_it == boost::polymorphic_downcast<const any_forward_iterator_wrapper*>(&other)->m_it;
}
virtual Reference dereference() const
virtual reference dereference() const
{
return *m_it;
return dereference_cast<reference>(*m_it);
}
private:
WrappedIterator m_it;
@ -283,7 +307,14 @@ namespace boost
>
{
BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalIteratorConcept<WrappedIterator> ));
typedef any_bidirectional_iterator_interface<
Reference,
Buffer
> base_type;
public:
typedef typename base_type::reference reference;
any_bidirectional_iterator_wrapper()
: m_it()
{
@ -353,9 +384,9 @@ namespace boost
return m_it == boost::polymorphic_downcast<const any_bidirectional_iterator_wrapper*>(&other)->m_it;
}
virtual Reference dereference() const
virtual reference dereference() const
{
return *m_it;
return dereference_cast<reference>(*m_it);
}
private:
@ -376,7 +407,14 @@ namespace boost
>
{
BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessIteratorConcept<WrappedIterator> ));
typedef any_random_access_iterator_interface<
Reference,
Difference,
Buffer
> base_type;
public:
typedef typename base_type::reference reference;
typedef Difference difference_type;
any_random_access_iterator_wrapper()
@ -457,9 +495,9 @@ namespace boost
m_it += offset;
}
virtual Reference dereference() const
virtual reference dereference() const
{
return *m_it;
return dereference_cast<reference>(*m_it);
}
virtual Difference distance_to(const any_random_access_iterator_interface<Reference, Difference, Buffer>& other) const

View File

@ -0,0 +1,66 @@
// Boost.Range library
//
// Copyright Neil Groves 2014.
//
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_DETAIL_HAS_MEMBER_SIZE_HPP
#define BOOST_RANGE_DETAIL_HAS_MEMBER_SIZE_HPP
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/is_member_function_pointer.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/cstdint.hpp>
namespace boost
{
namespace range_detail
{
template<class T>
class has_member_size_impl
{
private:
template<class U, U>
class check
{
};
template<class C>
static boost::uint8_t f(check<std::size_t(C::*)(void) const, &C::size>*);
template<class C>
static boost::uint16_t f(...);
public:
static const bool value =
(sizeof(f<T>(0)) == sizeof(boost::uint8_t));
typedef typename mpl::if_c<
(sizeof(f<T>(0)) == sizeof(boost::uint8_t)),
mpl::true_,
mpl::false_
>::type type;
};
template<class T>
struct has_member_size
{
typedef typename mpl::and_<
typename is_class<T>::type,
typename has_member_size_impl<const T>::type
>::type type;
static const bool value =
is_class<T>::value && has_member_size_impl<const T>::value;
};
} // namespace range_detail
}// namespace boost
#endif // include guard

View File

@ -95,6 +95,17 @@ namespace boost
return sz;
}
inline bool is_same_address(const void* l, const void* r)
{
return l == r;
}
template<class T1, class T2>
inline bool is_same_object(const T1& l, const T2& r)
{
return range_detail::is_same_address(&l, &r);
}
} // namespace 'range_detail'
} // namespace 'boost'

View File

@ -9,6 +9,9 @@
// aschoedl contributed an improvement to the determination
// of the Reference type parameter.
//
// Leonid Gershanovich reported Trac ticket 7376 about the dereference operator
// requiring identical reference types due to using the ternary if.
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_DETAIL_JOIN_ITERATOR_HPP_INCLUDED
@ -117,7 +120,8 @@ public:
return *m_it;
}
bool equal(const join_iterator_union& other, unsigned int selected) const
bool equal(const join_iterator_union& other,
unsigned int /*selected*/) const
{
return m_it == other.m_it;
}