mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-11 13:33:56 +00:00
Fix the problems described in this thread:
http://lists.boost.org/MailArchives/boost-users/msg08656.php [SVN r26410]
This commit is contained in:
parent
68268f81eb
commit
295ae05e40
@ -22,7 +22,11 @@
|
||||
# define BOOST_ITERATOR_CONFIG_DEF
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|
||||
// We enable this always now. Otherwise, the simple case in
|
||||
// libs/iterator/test/constant_iterator_arrow.cpp fails to compile
|
||||
// because the operator-> return is improperly deduced as a non-const
|
||||
// pointer.
|
||||
#if 1 || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|
||||
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531))
|
||||
|
||||
// Recall that in general, compilers without partial specialization
|
||||
|
@ -38,6 +38,8 @@ test-suite iterator
|
||||
[ compile iterator_archetype_cc.cpp ]
|
||||
[ compile-fail iter_archetype_default_ctor.cpp ]
|
||||
[ compile-fail lvalue_concept_fail.cpp ]
|
||||
[ compile constant_iterator_arrow.cpp ]
|
||||
[ compile-fail constant_iterator_arrow_fail.cpp ]
|
||||
[ run transform_iterator_test.cpp ]
|
||||
[ run indirect_iterator_test.cpp ]
|
||||
[ compile indirect_iter_member_types.cpp ]
|
||||
|
16
test/constant_iterator_arrow.cpp
Executable file
16
test/constant_iterator_arrow.cpp
Executable file
@ -0,0 +1,16 @@
|
||||
// Copyright David Abrahams 2004. Distributed under 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)
|
||||
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <utility>
|
||||
|
||||
struct my_iter : boost::iterator_adaptor<my_iter, std::pair<int,int> const*>
|
||||
{
|
||||
my_iter(std::pair<int,int> const*);
|
||||
my_iter();
|
||||
};
|
||||
|
||||
std::pair<int,int> const x(1,1);
|
||||
my_iter p(&x);
|
||||
int y = p->first; // operator-> attempts to return an non-const pointer
|
20
test/constant_iterator_arrow_fail.cpp
Executable file
20
test/constant_iterator_arrow_fail.cpp
Executable file
@ -0,0 +1,20 @@
|
||||
// Copyright David Abrahams 2004. Distributed under 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)
|
||||
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <utility>
|
||||
|
||||
struct my_iter : boost::iterator_adaptor<my_iter, std::pair<int,int> const*>
|
||||
{
|
||||
my_iter(std::pair<int,int> const*);
|
||||
my_iter();
|
||||
};
|
||||
|
||||
std::pair<int,int> const x(1,1);
|
||||
my_iter p(&x);
|
||||
|
||||
void test()
|
||||
{
|
||||
p->first = 3;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user