Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / smart_ptr / doc / smart_ptr / history.adoc
1 ////
2 Copyright 1999 Greg Colvin and Beman Dawes
3 Copyright 2002 Darin Adler
4 Copyright 2017 Peter Dimov
5
6 Distributed under the Boost Software License, Version 1.0.
7
8 See accompanying file LICENSE_1_0.txt or copy at
9 http://www.boost.org/LICENSE_1_0.txt
10 ////
11
12 [[history]]
13 [appendix]
14 # History and Acknowledgments
15 :idprefix: history_
16
17 ## Summer 1994
18
19 Greg Colvin http://www.open-std.org/jtc1/sc22/wg21/docs/papers/1994/N0555.pdf[proposed]
20 to the {cpp} Standards Committee classes named `auto_ptr` and `counted_ptr` which were very
21 similar to what we now call `scoped_ptr` and `shared_ptr`. In one of the very few cases
22 where the Library Working Group's recommendations were not followed by the full committee,
23 `counted_ptr` was rejected and surprising transfer-of-ownership semantics were added to `auto_ptr`.
24
25 ## October 1998
26
27 Beman Dawes proposed reviving the original semantics under the names `safe_ptr` and `counted_ptr`,
28 meeting of Per Andersson, Matt Austern, Greg Colvin, Sean Corfield, Pete Becker, Nico Josuttis,
29 Dietmar Kühl, Nathan Myers, Chichiang Wan and Judy Ward. During the discussion, the four new class
30 names were finalized, it was decided that there was no need to exactly follow the `std::auto_ptr`
31 interface, and various function signatures and semantics were finalized.
32
33 Over the next three months, several implementations were considered for `shared_ptr`, and discussed
34 on the http://www.boost.org/[boost.org] mailing list. The implementation questions revolved around
35 the reference count which must be kept, either attached to the pointed to object, or detached elsewhere.
36 Each of those variants have themselves two major variants:
37
38 * Direct detached: the `shared_ptr` contains a pointer to the object, and a pointer to the count. 
39 * Indirect detached: the `shared_ptr` contains a pointer to a helper object, which in turn contains a pointer to the object and the count. 
40 * Embedded attached: the count is a member of the object pointed to. 
41 * Placement attached: the count is attached via operator new manipulations.
42
43 Each implementation technique has advantages and disadvantages. We went so far as to run various timings
44 of the direct and indirect approaches, and found that at least on Intel Pentium chips there was very little
45 measurable difference. Kevlin Henney provided a paper he wrote on "Counted Body Techniques." Dietmar Kühl
46 suggested an elegant partial template specialization technique to allow users to choose which implementation
47 they preferred, and that was also experimented with.
48
49 But Greg Colvin and Jerry Schwarz argued that "parameterization will discourage users", and in the end we choose
50 to supply only the direct implementation.
51
52 ## May 1999
53
54 In April and May, 1999, Valentin Bonnard and David Abrahams made a number of suggestions resulting in numerous improvements.
55
56 ## September 1999
57
58 Luis Coelho provided `shared_ptr::swap` and `shared_array::swap`.
59
60 ## November 1999
61
62 Darin Adler provided `operator ==`, `operator !=`, and `std::swap` and `std::less` specializations for shared types.
63
64 ## May 2001
65
66 Vladimir Prus suggested requiring a complete type on destruction. Refinement evolved in discussions including Dave Abrahams,
67 Greg Colvin, Beman Dawes, Rainer Deyke, Peter Dimov, John Maddock, Vladimir Prus, Shankar Sai, and others.
68
69 ## January 2002
70
71 Peter Dimov reworked all four classes, adding features, fixing bugs, splitting them into four separate headers, and adding
72 `weak_ptr`.
73
74 ## March 2003
75
76 Peter Dimov, Beman Dawes and Greg Colvin http://open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1450.html[proposed] `shared_ptr`
77 and `weak_ptr` for inclusion in the Standard Library via the first Library Technical Report (known as TR1). The proposal was
78 accepted and eventually went on to become a part of the {cpp} standard in its 2011 iteration.
79
80 ## July 2007
81
82 Peter Dimov and Beman Dawes http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2351.htm[proposed] a number of enhancements
83 to `shared_ptr` as it was entering the working paper that eventually became the {cpp}11 standard.
84
85 ## November 2012
86
87 Glen Fernandes provided implementations of `make_shared` and `allocate_shared` for arrays. They achieve a single allocation
88 for an array that can be initialized with constructor arguments or initializer lists as well as overloads for default initialization
89 and no value initialization.
90
91 Peter Dimov aided this development by extending `shared_ptr` to support arrays via the syntax `shared_ptr<T[]>` and `shared_ptr<T[N]>`.
92
93 ## April 2013
94
95 Peter Dimov http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3640.html[proposed] the extension of `shared_ptr` to support
96 arrays for inclusion into the standard, and it was accepted.
97
98 ## February 2014
99
100 Glen Fernandes updated `make_shared` and `allocate_shared` to conform to the specification in {cpp} standard paper
101 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3870.html[N3870], and implemented `make_unique` for arrays and objects.
102
103 Peter Dimov and Glen Fernandes updated the scalar and array implementations, respectively, to resolve {cpp} standard library defect 2070.
104
105 ## February 2017
106
107 Glen Fernandes rewrote `allocate_shared` and `make_shared` for arrays for a more optimal and more maintainable implementation.
108
109 ## June 2017
110
111 Peter Dimov and Glen Fernandes rewrote the documentation in Asciidoc format.
112
113 Peter Dimov added `atomic_shared_ptr` and `local_shared_ptr`.
114
115 ## August 2019
116
117 Glen Fernandes implemented `allocate_unique` for scalars and arrays.