Opened 15 years ago
Closed 15 years ago
#1692 closed Bugs (fixed)
'iterator::m_it' declared public ONLY in test/debug-build, but always accessed from 'cicular_buffer::erase()'
Reported by: | Owned by: | Jan Gaspar | |
---|---|---|---|
Milestone: | To Be Determined | Component: | circular_buffer |
Version: | Boost Development Trunk | Severity: | Showstopper |
Keywords: | Cc: |
Description
In the current version of boost::circular_buffer, there is a small bug where iterator::m_it is declared private if not in test-mode (explains why this didn't get caught) but accessed from circular_buffer::erase(iterator, iterator) even in non-debug/non-test mode. This just causes a compiler error.
(I think just adding
template <class T, class Alloc> friend class circular_buffer;
should be enough.
)
/boost/boost/circular_buffer/details.hpp (r1.4) class iterator 222 #if !defined(BOOST_CB_TEST) && !BOOST_CB_ENABLE_DEBUG 223 private: 224 #endif 225 // Member variables 226 227 //! The circular buffer where the iterator points to. 228 const Buff* m_buff; 229 230 //! An internal iterator. 231 pointer m_it;
---
/boost/boost/circular_buffer/base.hpp (r1.8) circular_buffer::erase(iterator, iterator) 1717 pointer next = pos.m_it;
Change History (3)
comment:1 by , 15 years ago
Severity: | Problem → Showstopper |
---|
comment:2 by , 15 years ago
Status: | new → assigned |
---|
comment:3 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Several more methods are affected, not only erase().
I would fix it by declaring the members as public - friend does not work for all compilers in this case.