File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -207,13 +207,13 @@ namespace boost {
207
207
typedef std::ptrdiff_t difference_type;
208
208
209
209
// iterator support
210
- iterator begin () BOOST_NOEXCEPT { return iterator ( reinterpret_cast < T * >( this ) ); }
211
- const_iterator begin () const BOOST_NOEXCEPT { return const_iterator ( reinterpret_cast < const T * >( this ) ); }
212
- const_iterator cbegin () const BOOST_NOEXCEPT { return const_iterator ( reinterpret_cast < const T * >( this ) ); }
210
+ BOOST_CXX14_CONSTEXPR iterator begin () BOOST_NOEXCEPT { return data ( ); }
211
+ BOOST_CONSTEXPR const_iterator begin () const BOOST_NOEXCEPT { return data ( ); }
212
+ BOOST_CONSTEXPR const_iterator cbegin () const BOOST_NOEXCEPT { return data ( ); }
213
213
214
- iterator end () BOOST_NOEXCEPT { return begin (); }
215
- const_iterator end () const BOOST_NOEXCEPT { return begin (); }
216
- const_iterator cend () const BOOST_NOEXCEPT { return cbegin (); }
214
+ BOOST_CXX14_CONSTEXPR iterator end () BOOST_NOEXCEPT { return begin (); }
215
+ BOOST_CONSTEXPR const_iterator end () const BOOST_NOEXCEPT { return begin (); }
216
+ BOOST_CONSTEXPR const_iterator cend () const BOOST_NOEXCEPT { return cbegin (); }
217
217
218
218
// reverse iterator support
219
219
typedef std::reverse_iterator<iterator> reverse_iterator;
Original file line number Diff line number Diff line change @@ -44,7 +44,12 @@ void RunTests()
44
44
BOOST_TEST ( const_test_case.begin () == const_test_case.end ());
45
45
BOOST_TEST ( const_test_case.cbegin () == const_test_case.cend ());
46
46
47
- BOOST_TEST ( test_case.begin () != const_test_case.begin () );
47
+ // BOOST_TEST ( test_case.begin() != const_test_case.begin() );
48
+ //
49
+ // TR1 specified that begin() must return a unique value for zero-sized
50
+ // arrays. However, this makes constexpr unimplementable, and all standard
51
+ // libraries have converged on using nullptr instead (see LWG issue 2157.)
52
+
48
53
if ( test_case.data () == const_test_case.data () ) {
49
54
// Value of data is unspecified in TR1, so no requirement this test pass or fail
50
55
// However, it must compile!
You can’t perform that action at this time.
0 commit comments