Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #14444
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: A question on "uncopyable" that disable copy constructor |
| Date | 2012-02-23 18:33 +1300 |
| Message-ID | <9qm1d8Fv9eU1@mid.individual.net> (permalink) |
| References | <22985212.2610.1329972334326.JavaMail.geo-discussion-forums@ynnk21> |
On 02/23/12 05:45 PM, TH wrote:
> Meyer's Effective C++ book talks about the case where you may want to disallow compiler generated copy constructor. The example is:
>
> class HomeForSale {...}
>
> It doesn't make sense to do:
>
> HomeForSale h1(h2); or h1 = h2.
>
> No problem. However, Does disallowing the copy constructor effectively prohibit it from putting such object into a container type, as
>
> std::vector<HomeForSale> home_vec;
> home_vec.push_back(h1); // need copy constructor??
Yes.
> It sounds like a severe constraints on the possible use of such object, am I missing anything?
The reason not to allow copying? If it is inappropriate or too
expensive to copy a T, use a container of (smart) pointers to T.
--
Ian Collins
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
A question on "uncopyable" that disable copy constructor TH <python152@gmail.com> - 2012-02-22 20:45 -0800
Re: A question on "uncopyable" that disable copy constructor Ian Collins <ian-news@hotmail.com> - 2012-02-23 18:33 +1300
Re: A question on "uncopyable" that disable copy constructor Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-23 08:47 +0000
Re: A question on "uncopyable" that disable copy constructor Ian Collins <ian-news@hotmail.com> - 2012-02-26 08:16 +1300
Re: A question on "uncopyable" that disable copy constructor Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-25 19:49 +0000
Re: A question on "uncopyable" that disable copy constructor yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2012-02-27 14:32 +0000
Re: A question on "uncopyable" that disable copy constructor Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-27 15:54 +0000
Re: A question on "uncopyable" that disable copy constructor yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2012-02-27 16:15 +0000
Re: A question on "uncopyable" that disable copy constructor Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-27 20:58 +0000
Re: A question on "uncopyable" that disable copy constructor Ian Collins <ian-news@hotmail.com> - 2012-02-28 17:18 +1300
Re: A question on "uncopyable" that disable copy constructor Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-02-28 00:00 -0500
Re: A question on "uncopyable" that disable copy constructor Ian Collins <ian-news@hotmail.com> - 2012-02-28 20:09 +1300
Re: A question on "uncopyable" that disable copy constructor Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-28 21:19 +0000
Re: A question on "uncopyable" that disable copy constructor Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-03-04 01:05 -0500
Re: A question on "uncopyable" that disable copy constructor 88888 Dihedral <dihedral88888@googlemail.com> - 2012-03-04 18:01 -0800
Re: A question on "uncopyable" that disable copy constructor Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-28 22:02 +0000
Re: A question on "uncopyable" that disable copy constructor Ian Collins <ian-news@hotmail.com> - 2012-02-29 11:15 +1300
Re: A question on "uncopyable" that disable copy constructor Miles Bader <miles@gnu.org> - 2012-02-23 15:14 +0900
Re: A question on "uncopyable" that disable copy constructor "T.H." <python152@gmail.com> - 2012-02-23 01:51 -0800
Re: A question on "uncopyable" that disable copy constructor bartek szurgot <basz@no.spam> - 2012-02-24 17:18 +0100
Re: A question on "uncopyable" that disable copy constructor Juha Nieminen <nospam@thanks.invalid> - 2012-02-25 19:10 +0000
Re: A question on "uncopyable" that disable copy constructor Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-02-25 17:45 -0500
Re: A question on "uncopyable" that disable copy constructor Juha Nieminen <nospam@thanks.invalid> - 2012-02-26 09:38 +0000
Re: A question on "uncopyable" that disable copy constructor Juha Nieminen <nospam@thanks.invalid> - 2012-02-26 09:42 +0000
Re: A question on "uncopyable" that disable copy constructor Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-02-27 23:23 -0500
Re: A question on "uncopyable" that disable copy constructor 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-28 17:01 -0800
csiph-web