• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#//
2#// Boost.Pointer Container
3#//
4#//  Copyright Thorsten Ottosen 2003-2005. Use, modification and
5#//  distribution is subject to the Boost Software License, Version
6#//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
7#//  http://www.boost.org/LICENSE_1_0.txt)
8#//
9#// For more information, see http://www.boost.org/libs/ptr_container/
10#//
11
121. use splice() to speed up transfer for list
13
145. small usage exmaple with each class
15
1610. update tutorial to show boost::assign link + auto_ptr
17
18
1911. should find_key() be added to ptr_map?
20
21
22
2313. transfer for set/map may need to
24be revisted (rg. !from.empty() precondition)
25
26
2715. Some of the headlines are too  big...
28
29
3018. range-based sort() needs to be provided for list. use stable_sort for this purpose.
31
32
3319. use flat_set,flat_map internally when certain situations arise, eg. when the size of the objects
34    is small, eg. 4bytes (does this affect key=string?
35
36
37
3821. map::at() should throw bad_index
39
40auto_type skal v�re converter-bar til std::auto_ptr<U>, if the deleter is
41trivial (heap_clone_allocator)
42
43(Sp�rg Thomas Witt om denne �ndring can komme med...kan ikke �del�gge existerende kode, som
44vill have kaldt .release()) Kr�ve en hel del ambiguity resolution pga auto_ptr augument er
45templates og ikke non-templates! Desuden kan vi ikke bruge non-template argument, da alle
46converterings operatorer for auto_ptr tager en & argument og ikke en by-value!!! m�ske
47skal der blot et hack til, hvor vi tilf�jer en ny ukenkt klasse og overloader kun for
48den, og s� laver en implicit konvertering til denne i static_move_ptr
49
50The easiert implementation would be to detect its presence in the
51body of the range based overloads and then dispatch to that implementation.
52
53
5422. hvor gode er kompilere til at optimere release() for en auto_ptr. Hvordan med move_ptr
55and auto_ptr interaction? Contracts m� kunne fort�lle kompileren at den skal
56genere optimeret kode
57
58template< class T >
59class auto_ptr
60{
61   T* get() const;
62
63   //
64   // this expresses that the constructor is a no-op if
65   // the condition is true. This might be useful in many other
66   // context
67   //
68   ~auto_ptr()
69     precondition { if( get() == 0 ) return; }
70
71   T* release()
72    postcondition { get() == 0; }
73}
74
75...
76
77std::auto_ptr<T> p( new T );
78foo( p.release() );
79// don't generate destructor
80
81Does raw_storage iterator have an impact on in-place consrtcution
82
83
84