|
Boost : |
Subject: [boost] no match for operator= error with circular_buffer iterator when addressing buffer by reference?
From: Bernd Prager (bernd_at_[hidden])
Date: 2012-01-07 23:13:55
I am trying do use a circular_buffer iterator and run into problems when
I try to write a copy constructor for my class.
g++ (GCC) 4.5.3 generates following error:
Test.cpp: In copy constructor Test::Test(const Test&):
Test.cpp:23:18: error: no match for operator= in it2 =
boost::circular_buffer<T, Alloc>::begin() const [with T = int, Alloc =
std::allocator<int>, boost::circular_buffer<T, Alloc>::const_iterator =
boost::cb_details::iterator<boost::circular_buffer<int>,
boost::cb_details::const_traits<std::allocator<int> > >]()
/usr/local/include/boost/circular_buffer/details.hpp:253:15: note:
candidate is: boost::cb_details::iterator<Buff, Traits>&
boost::cb_details::iterator<Buff, Traits>::operator=(const
boost::cb_details::iterator<Buff, Traits>&) [with Buff =
boost::circular_buffer<int>, Traits =
boost::cb_details::nonconst_traits<std::allocator<int> >,
boost::cb_details::iterator<Buff, Traits> =
boost::cb_details::iterator<boost::circular_buffer<int>,
boost::cb_details::nonconst_traits<std::allocator<int> > >]
What do I miss. Can anybody help?
Thank you,
-- Bernd
#include <boost/circular_buffer.hpp>
class Test {
public:
Test();
Test(const Test&);
private:
boost::circular_buffer<int> b;
};
Test::Test() {
b.resize(10);
}
Test::Test(const Test &t) {
b.resize(10);
size_t s1 = b.size();
size_t s2 = t.b.size();
boost::circular_buffer<int>::iterator it1 = b.begin();
boost::circular_buffer<int>::iterator it2 = t.b.begin();
}
int main() {
Test *t = new Test();
return 0;
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk