forked from boostorg/iterator
Bug fix and associated unit tests
[SVN r1185]
This commit is contained in:
@@ -124,8 +124,8 @@ namespace boost
|
||||
readable_lvalue_iterator_tag
|
||||
, typename access_category_tag<Category,Reference>::type
|
||||
>
|
||||
, operator_arrow_proxy<Value>
|
||||
, Pointer
|
||||
, operator_arrow_proxy<Value>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
@@ -1,5 +1,6 @@
|
||||
SEARCH on testing.jam = $(BOOST_BUILD_PATH) ;
|
||||
include testing.jam ;
|
||||
run unit_tests.cpp ;
|
||||
run concept_tests.cpp ;
|
||||
run iterator_adaptor_cc.cpp ;
|
||||
run iterator_adaptor_test.cpp ;
|
||||
|
36
test/unit_tests.cpp
Executable file
36
test/unit_tests.cpp
Executable file
@@ -0,0 +1,36 @@
|
||||
// Copyright David Abrahams 2003. Permission to copy, use,
|
||||
// modify, sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
struct X { int a; };
|
||||
|
||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
namespace boost { namespace detail {
|
||||
template<> struct iterator_traits<X*>
|
||||
: ptr_iter_traits<X> {};
|
||||
}}
|
||||
#endif
|
||||
|
||||
struct Xiter : boost::iterator_adaptor<Xiter,X*>
|
||||
{
|
||||
Xiter();
|
||||
Xiter(X* p) : boost::iterator_adaptor<Xiter, X*>(p) {}
|
||||
};
|
||||
|
||||
void take_xptr(X*) {}
|
||||
void operator_arrow_test()
|
||||
{
|
||||
// check that the operator-> result is a pointer for lvalue iterators
|
||||
X x;
|
||||
take_xptr(Xiter(&x).operator->());
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
operator_arrow_test();
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user