forked from boostorg/range
ticket 7885 rvalue support for metafunctions.
This commit is contained in:
@ -65,7 +65,7 @@ struct range_const_iterator< T[sz] >
|
||||
template<typename C>
|
||||
struct range_const_iterator
|
||||
: range_detail::range_const_iterator<
|
||||
typename remove_reference<C>::type
|
||||
BOOST_DEDUCED_TYPENAME remove_reference<C>::type
|
||||
>
|
||||
{
|
||||
};
|
||||
|
@ -26,7 +26,8 @@ namespace boost
|
||||
|
||||
template< typename C >
|
||||
struct range_const_reverse_iterator
|
||||
: range_reverse_iterator<const typename remove_reference<C>::type>
|
||||
: range_reverse_iterator<
|
||||
const BOOST_DEDUCED_TYPENAME remove_reference<C>::type>
|
||||
{ };
|
||||
|
||||
} // namespace boost
|
||||
|
@ -18,11 +18,17 @@
|
||||
#include <boost/range/config.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template< class T >
|
||||
struct range_difference : iterator_difference< typename range_iterator<T>::type >
|
||||
struct range_difference
|
||||
: iterator_difference<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<
|
||||
BOOST_DEDUCED_TYPENAME remove_reference<T>::type
|
||||
>::type
|
||||
>
|
||||
{ };
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
namespace boost
|
||||
@ -67,12 +68,14 @@ namespace boost
|
||||
|
||||
template<class T>
|
||||
struct has_range_iterator
|
||||
: range_detail::has_range_iterator_impl<T>
|
||||
: range_detail::has_range_iterator_impl<
|
||||
BOOST_DEDUCED_TYPENAME remove_reference<T>::type>
|
||||
{};
|
||||
|
||||
template<class T>
|
||||
struct has_range_const_iterator
|
||||
: range_detail::has_range_const_iterator_impl<T>
|
||||
: range_detail::has_range_const_iterator_impl<
|
||||
BOOST_DEDUCED_TYPENAME remove_reference<T>::type>
|
||||
{};
|
||||
} // namespace boost
|
||||
|
||||
|
@ -19,12 +19,14 @@
|
||||
|
||||
|
||||
#include <boost/range/detail/extract_optional_type.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// default
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -34,7 +36,9 @@ namespace boost
|
||||
}
|
||||
|
||||
template< typename C >
|
||||
struct range_mutable_iterator : range_detail::extract_iterator<C>
|
||||
struct range_mutable_iterator
|
||||
: range_detail::extract_iterator<
|
||||
BOOST_DEDUCED_TYPENAME remove_reference<C>::type>
|
||||
{};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -22,7 +22,8 @@
|
||||
namespace boost
|
||||
{
|
||||
template< class T >
|
||||
struct range_pointer : iterator_pointer< typename range_iterator<T>::type >
|
||||
struct range_pointer
|
||||
: iterator_pointer< BOOST_DEDUCED_TYPENAME range_iterator<T>::type >
|
||||
{ };
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <boost/range/config.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
|
||||
|
||||
@ -30,7 +31,8 @@ namespace boost
|
||||
struct range_reverse_iterator
|
||||
{
|
||||
typedef reverse_iterator<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<C>::type > type;
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<
|
||||
BOOST_DEDUCED_TYPENAME remove_reference<C>::type>::type > type;
|
||||
};
|
||||
|
||||
|
||||
|
@ -147,17 +147,22 @@ test-suite range :
|
||||
[ range-test array ]
|
||||
# [ range-test atl : <include>$(VC71_ROOT)/atlmfc/include ]
|
||||
[ range-test begin ]
|
||||
[ range-test category ]
|
||||
[ range-test combine ]
|
||||
[ range-test compat2 ]
|
||||
[ range-test compat3 ]
|
||||
[ range-test const_iterator ]
|
||||
[ range-test const_ranges ]
|
||||
[ range-test const_reverse_iterator ]
|
||||
[ range-test counting_range ]
|
||||
[ range-test difference_type ]
|
||||
[ range-test end ]
|
||||
[ range-test extension_mechanism ]
|
||||
[ range-test extension_size ]
|
||||
[ range-test has_range_iterator ]
|
||||
[ range-test irange ]
|
||||
[ range-test istream_range ]
|
||||
[ range-test iterator ]
|
||||
[ range-test iterator_pair ]
|
||||
[ range-test iterator_range ]
|
||||
[ range-test iterator_range_drop ]
|
||||
@ -165,9 +170,16 @@ test-suite range :
|
||||
[ range-test iterator_range_variant ]
|
||||
# [ range-test mfc : <include>$(VC71_ROOT)/atlmfc/include ]
|
||||
[ range-test join ]
|
||||
[ range-test mutable_iterator ]
|
||||
[ range-test partial_workaround ]
|
||||
[ range-test pointer ]
|
||||
[ range-test pointer_as_iterator ]
|
||||
[ range-test reference ]
|
||||
[ range-test result_iterator ]
|
||||
[ range-test reverse_iterator ]
|
||||
[ range-test reverse_result_iterator ]
|
||||
[ range-test reversible_range ]
|
||||
[ range-test size_type ]
|
||||
[ range-test std_container ]
|
||||
[ range-test string ]
|
||||
[ range-test sub_range ]
|
||||
@ -178,5 +190,6 @@ test-suite range :
|
||||
[ range-test ticket_5811_indirected_optional ]
|
||||
[ range-test ticket_6715_iterator_range_equality ]
|
||||
[ range-test ticket_6944 ]
|
||||
[ range-test value_type ]
|
||||
;
|
||||
|
||||
|
61
test/category.cpp
Normal file
61
test/category.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and
|
||||
// distribution is 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/
|
||||
//
|
||||
|
||||
#include <boost/range/category.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_category()
|
||||
{
|
||||
typedef std::vector<int> cont;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
boost::iterator_category<cont::const_iterator>::type,
|
||||
boost::range_category<cont>::type
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
boost::iterator_category<cont::const_iterator>::type,
|
||||
boost::range_category<const cont>::type
|
||||
>::value));
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
boost::iterator_category<cont::const_iterator>::type,
|
||||
boost::range_category<cont&&>::type
|
||||
>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_test
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test =
|
||||
BOOST_TEST_SUITE("Boost.Range range_category meta-function");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&boost_range_test::test_category));
|
||||
|
||||
return test;
|
||||
}
|
61
test/const_iterator.cpp
Normal file
61
test/const_iterator.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and
|
||||
// distribution is 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/
|
||||
//
|
||||
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_const_iterator()
|
||||
{
|
||||
typedef std::vector<int> cont;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::const_iterator,
|
||||
boost::range_const_iterator<cont>::type
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::const_iterator,
|
||||
boost::range_const_iterator<const cont>::type
|
||||
>::value));
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::const_iterator,
|
||||
boost::range_const_iterator<cont&&>::type
|
||||
>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_test
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test =
|
||||
BOOST_TEST_SUITE("Boost.Range range_const_iterator meta-function");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&boost_range_test::test_const_iterator));
|
||||
|
||||
return test;
|
||||
}
|
62
test/const_reverse_iterator.cpp
Normal file
62
test/const_reverse_iterator.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and
|
||||
// distribution is 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/
|
||||
//
|
||||
|
||||
#include <boost/range/const_reverse_iterator.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_const_reverse_iterator()
|
||||
{
|
||||
typedef std::vector<int> cont;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
boost::reverse_iterator<cont::const_iterator>,
|
||||
boost::range_const_reverse_iterator<cont>::type
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
boost::reverse_iterator<cont::const_iterator>,
|
||||
boost::range_const_reverse_iterator<const cont>::type
|
||||
>::value));
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
boost::reverse_iterator<cont::const_iterator>,
|
||||
boost::range_const_reverse_iterator<cont&&>::type
|
||||
>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_test
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test =
|
||||
BOOST_TEST_SUITE(
|
||||
"Boost.Range range_const_reverse_iterator meta-function");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&boost_range_test::test_const_reverse_iterator));
|
||||
|
||||
return test;
|
||||
}
|
61
test/difference_type.cpp
Normal file
61
test/difference_type.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and
|
||||
// distribution is 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/
|
||||
//
|
||||
|
||||
#include <boost/range/difference_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_difference()
|
||||
{
|
||||
typedef std::vector<int> cont;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::difference_type,
|
||||
boost::range_difference<cont>::type
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::difference_type,
|
||||
boost::range_difference<const cont>::type
|
||||
>::value));
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::difference_type,
|
||||
boost::range_difference<cont&&>::type
|
||||
>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_test
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test =
|
||||
BOOST_TEST_SUITE("Boost.Range range_difference meta-function");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&boost_range_test::test_difference));
|
||||
|
||||
return test;
|
||||
}
|
@ -9,6 +9,7 @@
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
#include <boost/range/has_range_iterator.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
@ -35,12 +36,22 @@ namespace
|
||||
{
|
||||
test_has_range_iterator_impl< std::vector<int> >(true);
|
||||
test_has_range_iterator_impl< MockClassWithoutIterators >(false);
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
test_has_range_iterator_impl<std::vector<int>&&>(true);
|
||||
test_has_range_iterator_impl<MockClassWithoutIterators&&>(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void test_has_range_const_iterator()
|
||||
{
|
||||
test_has_range_const_iterator_impl< std::vector<int> >(true);
|
||||
test_has_range_const_iterator_impl< MockClassWithoutIterators >(false);
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
test_has_range_const_iterator_impl<std::vector<int>&&>(true);
|
||||
test_has_range_const_iterator_impl<MockClassWithoutIterators&&>(false);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
61
test/iterator.cpp
Normal file
61
test/iterator.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and
|
||||
// distribution is 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/
|
||||
//
|
||||
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_iterator()
|
||||
{
|
||||
typedef std::vector<int> cont;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::iterator,
|
||||
boost::range_iterator<cont>::type
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::const_iterator,
|
||||
boost::range_iterator<const cont>::type
|
||||
>::value));
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::iterator,
|
||||
boost::range_iterator<cont&&>::type
|
||||
>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_test
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test =
|
||||
BOOST_TEST_SUITE("Boost.Range range_iterator meta-function");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&boost_range_test::test_iterator));
|
||||
|
||||
return test;
|
||||
}
|
61
test/mutable_iterator.cpp
Normal file
61
test/mutable_iterator.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and
|
||||
// distribution is 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/
|
||||
//
|
||||
|
||||
#include <boost/range/mutable_iterator.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_mutable_iterator()
|
||||
{
|
||||
typedef std::vector<int> cont;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::iterator,
|
||||
boost::range_mutable_iterator<cont>::type
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::iterator,
|
||||
boost::range_mutable_iterator<const cont>::type
|
||||
>::value));
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::iterator,
|
||||
boost::range_mutable_iterator<cont&&>::type
|
||||
>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_test
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test =
|
||||
BOOST_TEST_SUITE("Boost.Range range_mutable_iterator meta-function");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&boost_range_test::test_mutable_iterator));
|
||||
|
||||
return test;
|
||||
}
|
61
test/pointer.cpp
Normal file
61
test/pointer.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and
|
||||
// distribution is 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/
|
||||
//
|
||||
|
||||
#include <boost/range/pointer.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_pointer()
|
||||
{
|
||||
typedef std::vector<int> cont;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::pointer,
|
||||
boost::range_pointer<cont>::type
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::const_pointer,
|
||||
boost::range_pointer<const cont>::type
|
||||
>::value));
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::pointer,
|
||||
boost::range_pointer<cont&&>::type
|
||||
>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_test
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test =
|
||||
BOOST_TEST_SUITE("Boost.Range range_pointer meta-function");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&boost_range_test::test_pointer));
|
||||
|
||||
return test;
|
||||
}
|
61
test/reference.cpp
Normal file
61
test/reference.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and
|
||||
// distribution is 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/
|
||||
//
|
||||
|
||||
#include <boost/range/reference.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_reference()
|
||||
{
|
||||
typedef std::vector<int> cont;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::reference,
|
||||
boost::range_reference<cont>::type
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::const_reference,
|
||||
boost::range_reference<const cont>::type
|
||||
>::value));
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::reference,
|
||||
boost::range_reference<cont&&>::type
|
||||
>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_test
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test =
|
||||
BOOST_TEST_SUITE("Boost.Range range_reference meta-function");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&boost_range_test::test_reference));
|
||||
|
||||
return test;
|
||||
}
|
61
test/result_iterator.cpp
Normal file
61
test/result_iterator.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and
|
||||
// distribution is 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/
|
||||
//
|
||||
|
||||
#include <boost/range/result_iterator.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_result_iterator()
|
||||
{
|
||||
typedef std::vector<int> cont;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::iterator,
|
||||
boost::range_result_iterator<cont>::type
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::const_iterator,
|
||||
boost::range_result_iterator<const cont>::type
|
||||
>::value));
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::iterator,
|
||||
boost::range_result_iterator<cont&&>::type
|
||||
>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_test
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test =
|
||||
BOOST_TEST_SUITE("Boost.Range range_result_iterator meta-function");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&boost_range_test::test_result_iterator));
|
||||
|
||||
return test;
|
||||
}
|
61
test/reverse_iterator.cpp
Normal file
61
test/reverse_iterator.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and
|
||||
// distribution is 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/
|
||||
//
|
||||
|
||||
#include <boost/range/reverse_iterator.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_reverse_iterator()
|
||||
{
|
||||
typedef std::vector<int> cont;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
boost::reverse_iterator<cont::iterator>,
|
||||
boost::range_reverse_iterator<cont>::type
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
boost::reverse_iterator<cont::const_iterator>,
|
||||
boost::range_reverse_iterator<const cont>::type
|
||||
>::value));
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
boost::reverse_iterator<cont::iterator>,
|
||||
boost::range_reverse_iterator<cont&&>::type
|
||||
>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_test
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test =
|
||||
BOOST_TEST_SUITE("Boost.Range range_reverse_iterator meta-function");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&boost_range_test::test_reverse_iterator));
|
||||
|
||||
return test;
|
||||
}
|
62
test/reverse_result_iterator.cpp
Normal file
62
test/reverse_result_iterator.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and
|
||||
// distribution is 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/
|
||||
//
|
||||
|
||||
#include <boost/range/reverse_result_iterator.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_reverse_result_iterator()
|
||||
{
|
||||
typedef std::vector<int> cont;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
boost::reverse_iterator<cont::iterator>,
|
||||
boost::range_reverse_result_iterator<cont>::type
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
boost::reverse_iterator<cont::const_iterator>,
|
||||
boost::range_reverse_result_iterator<const cont>::type
|
||||
>::value));
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
boost::reverse_iterator<cont::iterator>,
|
||||
boost::range_reverse_result_iterator<cont&&>::type
|
||||
>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_test
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test =
|
||||
BOOST_TEST_SUITE(
|
||||
"Boost.Range range_reverse_result_iterator meta-function");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&boost_range_test::test_reverse_result_iterator));
|
||||
|
||||
return test;
|
||||
}
|
61
test/size_type.cpp
Normal file
61
test/size_type.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and
|
||||
// distribution is 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/
|
||||
//
|
||||
|
||||
#include <boost/range/size_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_size()
|
||||
{
|
||||
typedef std::vector<int> cont;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::size_type,
|
||||
boost::range_size<cont>::type
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::size_type,
|
||||
boost::range_size<const cont>::type
|
||||
>::value));
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::size_type,
|
||||
boost::range_size<cont&&>::type
|
||||
>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_test
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test =
|
||||
BOOST_TEST_SUITE("Boost.Range range_size meta-function");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&boost_range_test::test_size));
|
||||
|
||||
return test;
|
||||
}
|
61
test/value_type.cpp
Normal file
61
test/value_type.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and
|
||||
// distribution is 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/
|
||||
//
|
||||
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
void test_value_type()
|
||||
{
|
||||
typedef std::vector<int> cont;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::value_type,
|
||||
boost::range_value<cont>::type
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::value_type,
|
||||
boost::range_value<const cont>::type
|
||||
>::value));
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<
|
||||
cont::value_type,
|
||||
boost::range_value<cont&&>::type
|
||||
>::value));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_test
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test =
|
||||
BOOST_TEST_SUITE("Boost.Range range_value meta-function");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&boost_range_test::test_value_type));
|
||||
|
||||
return test;
|
||||
}
|
Reference in New Issue
Block a user