Boost logo

Boost Users :

Subject: [Boost-users] [range_ex] range_ex conflicts with non_copyable
From: 041021042 (041021042_at_[hidden])
Date: 2009-04-02 01:22:31


The following code works well with old version of range_ex (Dec 2008), but when I update range_ex to an newer version (after Feb 2009), the code cannot compile.

#include <boost/range/algorithm.hpp>
#include <boost/ptr_container/ptr_vector.hpp>

struct A : boost::noncopyable {
    int a;
    A(int _a) : a(_a) {}
    bool operator == (const A& r) const { return a == r.a; }

int main()
    boost::ptr_vector<A> pva;
    A a(0);
    std::find(pva.begin(), pva.end(), a); // ok
    boost::find(pva, a); // cause an error

compiler: msvc2008

error message:
e:\zxg\boost\range_ex\range.cpp(8) : error C2248: 'boost::noncopyable_::noncopyable::noncopyable' : cannot access private member declared in class 'boost::noncopyable_::noncopyable'
        d:\software\boost_1_37_0\boost\noncopyable.hpp(27) : see declaration of 'boost::noncopyable_::noncopyable::noncopyable'
        d:\software\boost_1_37_0\boost\noncopyable.hpp(22) : see declaration of 'boost::noncopyable_::noncopyable'
        This diagnostic occurred in the compiler generated function 'A::A(const A &)'

Roger Zhou

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at