|
Boost Users : |
Subject: Re: [Boost-users] [range_ex] range_ex conflicts with non_copyable
From: Igor R (boost.lists_at_[hidden])
Date: 2009-04-05 16:03:51
> 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 &)'
What's the benefit of providing assignment operator but blocking the
copy-constructor?
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