$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] How to use noncopyable?
From: Yang Zhang (yanghatespam_at_[hidden])
Date: 2009-02-21 23:25:32
Hi, I can't figure out how to properly use noncopyable.  I'm always
getting things like "has a non-virtual destructor" warnings.  In fact,
compiling noncopyable_test.cpp gives me:
$ g++ -Wall -g3 -o noncopyable_test noncopyable_test.cpp -Wextra
-Wconversion -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings
-Winit-self -Wno-unused-parameter -Wparentheses
-Wmissing-format-attribute -Wfloat-equal -Winline -Woverloaded-virtual
-Wsign-promo -Wc++0x-compat -Wsynth
/opt/armed/include/boost/noncopyable.hpp: In copy constructor 
<unnamed>::DontTreadOnMe::DontTreadOnMe(const<unnamed>::DontTreadOnMe&):
/opt/armed/include/boost/noncopyable.hpp:27: error: 
boost::noncopyable_::noncopyable::noncopyable(const 
boost::noncopyable_::noncopyable&) is private
noncopyable_test.cpp:22: error: within this context
noncopyable_test.cpp: In function int main():
noncopyable_test.cpp:32: note: synthesized method 
<unnamed>::DontTreadOnMe::DontTreadOnMe(const<unnamed>::DontTreadOnMe&) 
first required here
/opt/armed/include/boost/noncopyable.hpp: In member function 
<unnamed>::DontTreadOnMe&<unnamed>::DontTreadOnMe::operator=(const<unnamed>::DontTreadOnMe&):
/opt/armed/include/boost/noncopyable.hpp:28: error: const 
boost::noncopyable_::noncopyable& 
boost::noncopyable_::noncopyable::operator=(const 
boost::noncopyable_::noncopyable&) is private
noncopyable_test.cpp:22: error: within this context
noncopyable_test.cpp: In function int main():
noncopyable_test.cpp:33: note: synthesized method 
<unnamed>::DontTreadOnMe&<unnamed>::DontTreadOnMe::operator=(const<unnamed>::DontTreadOnMe&) 
first required here
Any hints?  Thanks in advance.
-- Yang Zhang http://www.mit.edu/~y_z/