L
lbonafide
Every example I see (including on boost:
rg) of using noncopyable
involves inheriting from it privately. Is there a drawback from
inheriting publicly? Is it just that it's not a good example of and
"is-a" relationship?
#include <boost/utility.hpp>
class A : public boost::noncopyable {};
int main()
{
A a;
A b(a);
return 0;
}
g++ -Wall -I\boost_1_33_1 -c noncopy.cpp
noncopy.cpp: In copy constructor `A::A(const A&)':
/boost_1_33_1/boost/noncopyable.hpp:27: error:
`boost::noncopyable_::noncopyable
::noncopyable(const boost::noncopyable_::noncopyable&)' is private
noncopy.cpp:9: error: within this context
involves inheriting from it privately. Is there a drawback from
inheriting publicly? Is it just that it's not a good example of and
"is-a" relationship?
#include <boost/utility.hpp>
class A : public boost::noncopyable {};
int main()
{
A a;
A b(a);
return 0;
}
g++ -Wall -I\boost_1_33_1 -c noncopy.cpp
noncopy.cpp: In copy constructor `A::A(const A&)':
/boost_1_33_1/boost/noncopyable.hpp:27: error:
`boost::noncopyable_::noncopyable
::noncopyable(const boost::noncopyable_::noncopyable&)' is private
noncopy.cpp:9: error: within this context