|
Boost Users : |
From: Olaf Petzold (yg-boost-users_at_[hidden])
Date: 2002-08-27 11:23:26
Hi,
now I have a new problem - const correctness.
---8<---
#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
#include <boost/shared_ptr.hpp>
class Doc
{
public:
virtual ~Doc() { }
public:
const std::vector<double>& foo() const { return m_foo; }
protected:
std::vector<double>& foo() { return m_foo; }
private:
std::vector<double> m_foo;
};
using namespace std;
int main()
{
boost::shared_ptr<Doc> lp_doc( new Doc );
std::copy(lp_doc->foo().begin(), lp_doc->foo().end(),
std::ostream_iterator<double>(cout, " ") );
cout << endl;
}
--->8---
`std::vector<double, std::allocator<double> >& Doc::foo()' is protected
I hoped std::copy takes the const foo() member function.
Thanks
olaf
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net