Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #14548
| From | yatremblay@bel1lin202.(none) (Yannick Tremblay) |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: A question on "uncopyable" that disable copy constructor |
| Date | 2012-02-27 16:15 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <jiga7c$4rs$1@dont-email.me> (permalink) |
| References | <22985212.2610.1329972334326.JavaMail.geo-discussion-forums@ynnk21> <slrnjkieqh.1ls.grahn+nntp@frailea.sa.invalid> <jig452$rua$1@dont-email.me> <slrnjkn9pb.1ls.grahn+nntp@frailea.sa.invalid> |
In article <slrnjkn9pb.1ls.grahn+nntp@frailea.sa.invalid>, Jorgen Grahn <grahn+nntp@snipabacken.se> wrote: >On Mon, 2012-02-27, yatremblay@bel1lin202.(none) (Yannick Tremblay) wrote: >> In article <slrnjkieqh.1ls.grahn+nntp@frailea.sa.invalid>, >> Jorgen Grahn <grahn+nntp@snipabacken.se> wrote: >>>On Sat, 2012-02-25, Ian Collins wrote: >>>> On 02/23/12 09:47 PM, Jorgen Grahn wrote: >... >>>>> It should be added though, that the uniqueness of a HomeForSale is not >>>>> enough reason to go crazy with smart pointers. If I saw a need to >>>>> place such a thing in a std::vector, I wouldn't hesitate to make it >>>>> copyable. I would also (reluctantly) add a default constructor if >>>>> needed, even though it means introducing "the nil home for sale". >>>> >>>> That's why I clearly said "If it is inappropriate or too expensive to >>>> copy a T". Some things shouldn't, or simply can't be copied. >>> >>>I know you did; I just added my view that conceptual uniqueness of >>>things like a HomeForSale does not make copying "inappropriate" >>>enough. >> >> I am quite willing to agree with the idea that conceptual uniqueness >> may not necessarily require to actually make the object non-copyable. >> If there's really a need for the object to be copied, then by all >> mean, go for it and figure out a different way to preserve uniqueness. >> >> I am however concerned with the statement "go crazy with smart >> pointer". Are you suggesting that: >> >> std::vector< std::shared_ptr<HomeForSale> > home_vec; >> >> is going crazy? > >How could I tell without context? > >I'm just saying that if std::vector is the only reason to add a >default constructor and copy constructor to HomeForSale, then I curse >under my breath, and then find a way to implement and document them. >I wouldn't want to see any kind of pointer used /just to avoid that/. I still don't follow you. We have the HomeForSale class. It is non-sensical to copy a HomeForSale and the concept a a default HomeForSale is also non-sensical (we don't live in dark utopia of default homes :-) But /just to avoid using any kind of pointers/, you find a way to implement copying and default construction that you then need to document to explain to future generation that they should never be used per se and that they are only a hack to fullfill the std::vector requirements... Why is using "any kind of pointer" such a bad thing that it is worth jumping through hoop to avoid doing it? Yannick
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