Timeline for Possible alternatives to copy constructors
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 13, 2015 at 9:46 | comment | added | Oebele | Turns out this solution is not applicable in the current case, but I am sure I will use it in an other wrapper. Thanks! | |
Aug 12, 2015 at 14:54 | history | edited | David Hammen | CC BY-SA 3.0 |
added 921 characters in body
|
Aug 12, 2015 at 14:34 | comment | added | David Hammen | @Oebele - I did update my answer, quite a few minutes ago. Then I saw that I hadn't pushed the commit button. | |
Aug 12, 2015 at 14:33 | history | edited | David Hammen | CC BY-SA 3.0 |
added 244 characters in body
|
Aug 12, 2015 at 14:30 | comment | added | Oebele |
@DavidHammen so, the first const in your example should be removed? If so could you please update your answer to reflect that?
|
|
Aug 12, 2015 at 14:27 | comment | added | David Hammen |
@rwong - The const that preceded shared_ptr<const lib_type> was indeed a typo. Thanks for catching it; I fixed it.
|
|
Aug 12, 2015 at 14:26 | comment | added | rwong |
A shared_ptr which has a template argument of const lib_type means that this smart pointer allows you to access an instance lib_type that is const-qualified (either by pointer or by reference), meaning that you cannot write to its public fields or call its non-const-qualified methods.
|
|
Aug 12, 2015 at 14:01 | comment | added | Oebele |
What, effectively, does it mean if a shared_ptr is const ? The contents cannot be changed, but that does not matter, because it is a copy, right? Does it also mean it can't be copied, as that changes the reference count? I only see downsides of doing that. const ing the contents is nice though.
|
|
Aug 12, 2015 at 13:55 | comment | added | Niall | I like the return type here - very neat. | |
Aug 12, 2015 at 13:32 | history | answered | David Hammen | CC BY-SA 3.0 |