author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:27:01 +0100 | |
branch | Symbian2 |
changeset 3 | e1b950c65cb4 |
parent 2 | epoc32/include/stdapis/boost/optional/optional.hpp@2fe1408b6811 |
child 4 | 837f303aceeb |
permissions | -rw-r--r-- |
2
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
1 |
// Copyright (C) 2003, Fernando Luis Cacciola Carballal. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
2 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
3 |
// Use, modification, and distribution is subject to the Boost Software |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
4 |
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
5 |
// http://www.boost.org/LICENSE_1_0.txt) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
6 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
7 |
// See http://www.boost.org/lib/optional for documentation. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
8 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
9 |
// You are welcome to contact the author at: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
10 |
// fernando_cacciola@hotmail.com |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
11 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
12 |
#ifndef BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
13 |
#define BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
14 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
15 |
#include<new> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
16 |
#include<algorithm> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
17 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
18 |
#include "boost/config.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
19 |
#include "boost/assert.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
20 |
#include "boost/type.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
21 |
#include "boost/type_traits/alignment_of.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
22 |
#include "boost/type_traits/type_with_alignment.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
23 |
#include "boost/type_traits/remove_reference.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
24 |
#include "boost/type_traits/is_reference.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
25 |
#include "boost/mpl/if.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
26 |
#include "boost/mpl/bool.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
27 |
#include "boost/mpl/not.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
28 |
#include "boost/detail/reference_content.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
29 |
#include "boost/none.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
30 |
#include "boost/utility/compare_pointees.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
31 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
32 |
#include "boost/optional/optional_fwd.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
33 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
34 |
#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
35 |
// VC6.0 has the following bug: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
36 |
// When a templated assignment operator exist, an implicit conversion |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
37 |
// constructing an optional<T> is used when assigment of the form: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
38 |
// optional<T> opt ; opt = T(...); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
39 |
// is compiled. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
40 |
// However, optional's ctor is _explicit_ and the assignemt shouldn't compile. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
41 |
// Therefore, for VC6.0 templated assignment is disabled. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
42 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
43 |
#define BOOST_OPTIONAL_NO_CONVERTING_ASSIGNMENT |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
44 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
45 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
46 |
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
47 |
// VC7.0 has the following bug: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
48 |
// When both a non-template and a template copy-ctor exist |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
49 |
// and the templated version is made 'explicit', the explicit is also |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
50 |
// given to the non-templated version, making the class non-implicitely-copyable. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
51 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
52 |
#define BOOST_OPTIONAL_NO_CONVERTING_COPY_CTOR |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
53 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
54 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
55 |
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION,<=700) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
56 |
// AFAICT only VC7.1 correctly resolves the overload set |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
57 |
// that includes the in-place factory taking functions, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
58 |
// so for the other VC versions, in-place factory support |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
59 |
// is disabled |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
60 |
#define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
61 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
62 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
63 |
#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
64 |
// BCB (5.5.1) cannot parse the nested template struct in an inplace factory. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
65 |
#define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
66 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
67 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
68 |
#if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) \ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
69 |
&& BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581) ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
70 |
// BCB (up to 5.64) has the following bug: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
71 |
// If there is a member function/operator template of the form |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
72 |
// template<class Expr> mfunc( Expr expr ) ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
73 |
// some calls are resolved to this even if there are other better matches. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
74 |
// The effect of this bug is that calls to converting ctors and assignments |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
75 |
// are incrorrectly sink to this general catch-all member function template as shown above. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
76 |
#define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
77 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
78 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
79 |
// Daniel Wallin discovered that bind/apply.hpp badly interacts with the apply<> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
80 |
// member template of a factory as used in the optional<> implementation. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
81 |
// He proposed this simple fix which is to move the call to apply<> outside |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
82 |
// namespace boost. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
83 |
namespace boost_optional_detail |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
84 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
85 |
template <class T, class Factory> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
86 |
void construct(Factory const& factory, void* address) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
87 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
88 |
factory.BOOST_NESTED_TEMPLATE apply<T>(address); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
89 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
90 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
91 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
92 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
93 |
namespace boost { |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
94 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
95 |
class in_place_factory_base ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
96 |
class typed_in_place_factory_base ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
97 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
98 |
namespace optional_detail { |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
99 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
100 |
// This local class is used instead of that in "aligned_storage.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
101 |
// because I've found the 'official' class to ICE BCB5.5 |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
102 |
// when some types are used with optional<> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
103 |
// (due to sizeof() passed down as a non-type template parameter) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
104 |
template <class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
105 |
class aligned_storage |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
106 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
107 |
// Borland ICEs if unnamed unions are used for this! |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
108 |
union dummy_u |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
109 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
110 |
char data[ sizeof(T) ]; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
111 |
BOOST_DEDUCED_TYPENAME type_with_alignment< |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
112 |
::boost::alignment_of<T>::value >::type aligner_; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
113 |
} dummy_ ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
114 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
115 |
public: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
116 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
117 |
void const* address() const { return &dummy_.data[0]; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
118 |
void * address() { return &dummy_.data[0]; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
119 |
} ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
120 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
121 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
122 |
struct types_when_isnt_ref |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
123 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
124 |
typedef T const& reference_const_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
125 |
typedef T & reference_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
126 |
typedef T const* pointer_const_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
127 |
typedef T * pointer_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
128 |
typedef T const& argument_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
129 |
} ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
130 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
131 |
struct types_when_is_ref |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
132 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
133 |
typedef BOOST_DEDUCED_TYPENAME remove_reference<T>::type raw_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
134 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
135 |
typedef raw_type& reference_const_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
136 |
typedef raw_type& reference_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
137 |
typedef raw_type* pointer_const_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
138 |
typedef raw_type* pointer_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
139 |
typedef raw_type& argument_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
140 |
} ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
141 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
142 |
struct optional_tag {} ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
143 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
144 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
145 |
class optional_base : public optional_tag |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
146 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
147 |
private : |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
148 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
149 |
typedef |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
150 |
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
151 |
BOOST_DEDUCED_TYPENAME |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
152 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
153 |
::boost::detail::make_reference_content<T>::type internal_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
154 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
155 |
typedef aligned_storage<internal_type> storage_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
156 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
157 |
typedef types_when_isnt_ref<T> types_when_not_ref ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
158 |
typedef types_when_is_ref<T> types_when_ref ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
159 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
160 |
typedef optional_base<T> this_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
161 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
162 |
protected : |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
163 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
164 |
typedef T value_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
165 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
166 |
typedef mpl::true_ is_reference_tag ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
167 |
typedef mpl::false_ is_not_reference_tag ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
168 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
169 |
typedef BOOST_DEDUCED_TYPENAME is_reference<T>::type is_reference_predicate ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
170 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
171 |
typedef BOOST_DEDUCED_TYPENAME mpl::if_<is_reference_predicate,types_when_ref,types_when_not_ref>::type types ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
172 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
173 |
typedef bool (this_type::*unspecified_bool_type)() const; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
174 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
175 |
typedef BOOST_DEDUCED_TYPENAME types::reference_type reference_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
176 |
typedef BOOST_DEDUCED_TYPENAME types::reference_const_type reference_const_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
177 |
typedef BOOST_DEDUCED_TYPENAME types::pointer_type pointer_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
178 |
typedef BOOST_DEDUCED_TYPENAME types::pointer_const_type pointer_const_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
179 |
typedef BOOST_DEDUCED_TYPENAME types::argument_type argument_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
180 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
181 |
// Creates an optional<T> uninitialized. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
182 |
// No-throw |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
183 |
optional_base() |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
184 |
: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
185 |
m_initialized(false) {} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
186 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
187 |
// Creates an optional<T> uninitialized. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
188 |
// No-throw |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
189 |
optional_base ( none_t ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
190 |
: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
191 |
m_initialized(false) {} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
192 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
193 |
// Creates an optional<T> initialized with 'val'. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
194 |
// Can throw if T::T(T const&) does |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
195 |
optional_base ( argument_type val ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
196 |
: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
197 |
m_initialized(false) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
198 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
199 |
construct(val); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
200 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
201 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
202 |
// Creates an optional<T> initialized with 'val' IFF cond is true, otherwise creates an uninitialzed optional<T>. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
203 |
// Can throw if T::T(T const&) does |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
204 |
optional_base ( bool cond, argument_type val ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
205 |
: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
206 |
m_initialized(false) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
207 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
208 |
if ( cond ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
209 |
construct(val); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
210 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
211 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
212 |
// Creates a deep copy of another optional<T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
213 |
// Can throw if T::T(T const&) does |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
214 |
optional_base ( optional_base const& rhs ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
215 |
: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
216 |
m_initialized(false) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
217 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
218 |
if ( rhs.is_initialized() ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
219 |
construct(rhs.get_impl()); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
220 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
221 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
222 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
223 |
// This is used for both converting and in-place constructions. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
224 |
// Derived classes use the 'tag' to select the appropriate |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
225 |
// implementation (the correct 'construct()' overload) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
226 |
template<class Expr> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
227 |
explicit optional_base ( Expr const& expr, Expr const* tag ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
228 |
: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
229 |
m_initialized(false) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
230 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
231 |
construct(expr,tag); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
232 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
233 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
234 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
235 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
236 |
// No-throw (assuming T::~T() doesn't) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
237 |
~optional_base() { destroy() ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
238 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
239 |
// Assigns from another optional<T> (deep-copies the rhs value) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
240 |
void assign ( optional_base const& rhs ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
241 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
242 |
if (is_initialized()) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
243 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
244 |
if ( rhs.is_initialized() ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
245 |
assign_value(rhs.get_impl(), is_reference_predicate() ); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
246 |
else destroy(); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
247 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
248 |
else |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
249 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
250 |
if ( rhs.is_initialized() ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
251 |
construct(rhs.get_impl()); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
252 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
253 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
254 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
255 |
// Assigns from another _convertible_ optional<U> (deep-copies the rhs value) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
256 |
template<class U> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
257 |
void assign ( optional<U> const& rhs ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
258 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
259 |
if (is_initialized()) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
260 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
261 |
if ( rhs.is_initialized() ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
262 |
assign_value(static_cast<value_type>(rhs.get()), is_reference_predicate() ); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
263 |
else destroy(); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
264 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
265 |
else |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
266 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
267 |
if ( rhs.is_initialized() ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
268 |
construct(static_cast<value_type>(rhs.get())); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
269 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
270 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
271 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
272 |
// Assigns from a T (deep-copies the rhs value) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
273 |
void assign ( argument_type val ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
274 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
275 |
if (is_initialized()) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
276 |
assign_value(val, is_reference_predicate() ); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
277 |
else construct(val); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
278 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
279 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
280 |
// Assigns from "none", destroying the current value, if any, leaving this UNINITIALIZED |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
281 |
// No-throw (assuming T::~T() doesn't) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
282 |
void assign ( none_t ) { destroy(); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
283 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
284 |
#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
285 |
template<class Expr> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
286 |
void assign_expr ( Expr const& expr, Expr const* tag ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
287 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
288 |
if (is_initialized()) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
289 |
assign_expr_to_initialized(expr,tag); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
290 |
else construct(expr,tag); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
291 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
292 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
293 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
294 |
public : |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
295 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
296 |
// Destroys the current value, if any, leaving this UNINITIALIZED |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
297 |
// No-throw (assuming T::~T() doesn't) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
298 |
void reset() { destroy(); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
299 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
300 |
// Replaces the current value -if any- with 'val' |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
301 |
void reset ( argument_type val ) { assign(val); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
302 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
303 |
// Returns a pointer to the value if this is initialized, otherwise, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
304 |
// returns NULL. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
305 |
// No-throw |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
306 |
pointer_const_type get_ptr() const { return m_initialized ? get_ptr_impl() : 0 ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
307 |
pointer_type get_ptr() { return m_initialized ? get_ptr_impl() : 0 ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
308 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
309 |
bool is_initialized() const { return m_initialized ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
310 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
311 |
protected : |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
312 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
313 |
void construct ( argument_type val ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
314 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
315 |
new (m_storage.address()) internal_type(val) ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
316 |
m_initialized = true ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
317 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
318 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
319 |
#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
320 |
// Constructs in-place using the given factory |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
321 |
template<class Expr> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
322 |
void construct ( Expr const& factory, in_place_factory_base const* ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
323 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
324 |
BOOST_STATIC_ASSERT ( ::boost::mpl::not_<is_reference_predicate>::value ) ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
325 |
boost_optional_detail::construct<value_type>(factory, m_storage.address()); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
326 |
m_initialized = true ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
327 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
328 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
329 |
// Constructs in-place using the given typed factory |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
330 |
template<class Expr> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
331 |
void construct ( Expr const& factory, typed_in_place_factory_base const* ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
332 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
333 |
BOOST_STATIC_ASSERT ( ::boost::mpl::not_<is_reference_predicate>::value ) ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
334 |
factory.apply(m_storage.address()) ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
335 |
m_initialized = true ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
336 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
337 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
338 |
template<class Expr> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
339 |
void assign_expr_to_initialized ( Expr const& factory, in_place_factory_base const* tag ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
340 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
341 |
destroy(); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
342 |
construct(factory,tag); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
343 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
344 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
345 |
// Constructs in-place using the given typed factory |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
346 |
template<class Expr> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
347 |
void assign_expr_to_initialized ( Expr const& factory, typed_in_place_factory_base const* tag ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
348 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
349 |
destroy(); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
350 |
construct(factory,tag); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
351 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
352 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
353 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
354 |
// Constructs using any expression implicitely convertible to the single argument |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
355 |
// of a one-argument T constructor. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
356 |
// Converting constructions of optional<T> from optional<U> uses this function with |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
357 |
// 'Expr' being of type 'U' and relying on a converting constructor of T from U. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
358 |
template<class Expr> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
359 |
void construct ( Expr const& expr, void const* ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
360 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
361 |
new (m_storage.address()) internal_type(expr) ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
362 |
m_initialized = true ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
363 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
364 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
365 |
// Assigns using a form any expression implicitely convertible to the single argument |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
366 |
// of a T's assignment operator. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
367 |
// Converting assignments of optional<T> from optional<U> uses this function with |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
368 |
// 'Expr' being of type 'U' and relying on a converting assignment of T from U. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
369 |
template<class Expr> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
370 |
void assign_expr_to_initialized ( Expr const& expr, void const* ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
371 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
372 |
assign_value(expr, is_reference_predicate()); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
373 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
374 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
375 |
#ifdef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
376 |
// BCB5.64 (and probably lower versions) workaround. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
377 |
// The in-place factories are supported by means of catch-all constructors |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
378 |
// and assignment operators (the functions are parameterized in terms of |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
379 |
// an arbitrary 'Expr' type) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
380 |
// This compiler incorrectly resolves the overload set and sinks optional<T> and optional<U> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
381 |
// to the 'Expr'-taking functions even though explicit overloads are present for them. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
382 |
// Thus, the following overload is needed to properly handle the case when the 'lhs' |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
383 |
// is another optional. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
384 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
385 |
// For VC<=70 compilers this workaround dosen't work becasue the comnpiler issues and error |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
386 |
// instead of choosing the wrong overload |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
387 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
388 |
// Notice that 'Expr' will be optional<T> or optional<U> (but not optional_base<..>) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
389 |
template<class Expr> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
390 |
void construct ( Expr const& expr, optional_tag const* ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
391 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
392 |
if ( expr.is_initialized() ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
393 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
394 |
// An exception can be thrown here. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
395 |
// It it happens, THIS will be left uninitialized. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
396 |
new (m_storage.address()) internal_type(expr.get()) ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
397 |
m_initialized = true ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
398 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
399 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
400 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
401 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
402 |
void assign_value ( argument_type val, is_not_reference_tag ) { get_impl() = val; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
403 |
void assign_value ( argument_type val, is_reference_tag ) { construct(val); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
404 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
405 |
void destroy() |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
406 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
407 |
if ( m_initialized ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
408 |
destroy_impl(is_reference_predicate()) ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
409 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
410 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
411 |
unspecified_bool_type safe_bool() const { return m_initialized ? &this_type::is_initialized : 0 ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
412 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
413 |
reference_const_type get_impl() const { return dereference(get_object(), is_reference_predicate() ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
414 |
reference_type get_impl() { return dereference(get_object(), is_reference_predicate() ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
415 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
416 |
pointer_const_type get_ptr_impl() const { return cast_ptr(get_object(), is_reference_predicate() ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
417 |
pointer_type get_ptr_impl() { return cast_ptr(get_object(), is_reference_predicate() ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
418 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
419 |
private : |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
420 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
421 |
// internal_type can be either T or reference_content<T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
422 |
internal_type const* get_object() const { return static_cast<internal_type const*>(m_storage.address()); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
423 |
internal_type * get_object() { return static_cast<internal_type *> (m_storage.address()); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
424 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
425 |
// reference_content<T> lacks an implicit conversion to T&, so the following is needed to obtain a proper reference. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
426 |
reference_const_type dereference( internal_type const* p, is_not_reference_tag ) const { return *p ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
427 |
reference_type dereference( internal_type* p, is_not_reference_tag ) { return *p ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
428 |
reference_const_type dereference( internal_type const* p, is_reference_tag ) const { return p->get() ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
429 |
reference_type dereference( internal_type* p, is_reference_tag ) { return p->get() ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
430 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
431 |
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581)) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
432 |
void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->internal_type::~internal_type() ; m_initialized = false ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
433 |
#else |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
434 |
void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->T::~T() ; m_initialized = false ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
435 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
436 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
437 |
void destroy_impl ( is_reference_tag ) { m_initialized = false ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
438 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
439 |
// If T is of reference type, trying to get a pointer to the held value must result in a compile-time error. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
440 |
// Decent compilers should disallow conversions from reference_content<T>* to T*, but just in case, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
441 |
// the following olverloads are used to filter out the case and guarantee an error in case of T being a reference. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
442 |
pointer_const_type cast_ptr( internal_type const* p, is_not_reference_tag ) const { return p ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
443 |
pointer_type cast_ptr( internal_type * p, is_not_reference_tag ) { return p ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
444 |
pointer_const_type cast_ptr( internal_type const* p, is_reference_tag ) const { return &p->get() ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
445 |
pointer_type cast_ptr( internal_type * p, is_reference_tag ) { return &p->get() ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
446 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
447 |
bool m_initialized ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
448 |
storage_type m_storage ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
449 |
} ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
450 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
451 |
} // namespace optional_detail |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
452 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
453 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
454 |
class optional : public optional_detail::optional_base<T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
455 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
456 |
typedef optional_detail::optional_base<T> base ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
457 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
458 |
typedef BOOST_DEDUCED_TYPENAME base::unspecified_bool_type unspecified_bool_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
459 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
460 |
public : |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
461 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
462 |
typedef optional<T> this_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
463 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
464 |
typedef BOOST_DEDUCED_TYPENAME base::value_type value_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
465 |
typedef BOOST_DEDUCED_TYPENAME base::reference_type reference_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
466 |
typedef BOOST_DEDUCED_TYPENAME base::reference_const_type reference_const_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
467 |
typedef BOOST_DEDUCED_TYPENAME base::pointer_type pointer_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
468 |
typedef BOOST_DEDUCED_TYPENAME base::pointer_const_type pointer_const_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
469 |
typedef BOOST_DEDUCED_TYPENAME base::argument_type argument_type ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
470 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
471 |
// Creates an optional<T> uninitialized. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
472 |
// No-throw |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
473 |
optional() : base() {} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
474 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
475 |
// Creates an optional<T> uninitialized. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
476 |
// No-throw |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
477 |
optional( none_t none_ ) : base(none_) {} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
478 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
479 |
// Creates an optional<T> initialized with 'val'. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
480 |
// Can throw if T::T(T const&) does |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
481 |
optional ( argument_type val ) : base(val) {} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
482 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
483 |
// Creates an optional<T> initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
484 |
// Can throw if T::T(T const&) does |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
485 |
optional ( bool cond, argument_type val ) : base(cond,val) {} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
486 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
487 |
#ifndef BOOST_OPTIONAL_NO_CONVERTING_COPY_CTOR |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
488 |
// NOTE: MSVC needs templated versions first |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
489 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
490 |
// Creates a deep copy of another convertible optional<U> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
491 |
// Requires a valid conversion from U to T. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
492 |
// Can throw if T::T(U const&) does |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
493 |
template<class U> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
494 |
explicit optional ( optional<U> const& rhs ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
495 |
: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
496 |
base() |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
497 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
498 |
if ( rhs.is_initialized() ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
499 |
this->construct(rhs.get()); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
500 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
501 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
502 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
503 |
#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
504 |
// Creates an optional<T> with an expression which can be either |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
505 |
// (a) An instance of InPlaceFactory (i.e. in_place(a,b,...,n); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
506 |
// (b) An instance of TypedInPlaceFactory ( i.e. in_place<T>(a,b,...,n); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
507 |
// (c) Any expression implicitely convertible to the single type |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
508 |
// of a one-argument T's constructor. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
509 |
// (d*) Weak compilers (BCB) might also resolved Expr as optional<T> and optional<U> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
510 |
// even though explicit overloads are present for these. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
511 |
// Depending on the above some T ctor is called. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
512 |
// Can throw is the resolved T ctor throws. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
513 |
template<class Expr> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
514 |
explicit optional ( Expr const& expr ) : base(expr,&expr) {} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
515 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
516 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
517 |
// Creates a deep copy of another optional<T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
518 |
// Can throw if T::T(T const&) does |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
519 |
optional ( optional const& rhs ) : base(rhs) {} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
520 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
521 |
// No-throw (assuming T::~T() doesn't) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
522 |
~optional() {} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
523 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
524 |
#if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
525 |
// Assigns from an expression. See corresponding constructor. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
526 |
// Basic Guarantee: If the resolved T ctor throws, this is left UNINITIALIZED |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
527 |
template<class Expr> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
528 |
optional& operator= ( Expr expr ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
529 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
530 |
this->assign_expr(expr,&expr); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
531 |
return *this ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
532 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
533 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
534 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
535 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
536 |
#ifndef BOOST_OPTIONAL_NO_CONVERTING_ASSIGNMENT |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
537 |
// Assigns from another convertible optional<U> (converts && deep-copies the rhs value) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
538 |
// Requires a valid conversion from U to T. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
539 |
// Basic Guarantee: If T::T( U const& ) throws, this is left UNINITIALIZED |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
540 |
template<class U> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
541 |
optional& operator= ( optional<U> const& rhs ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
542 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
543 |
this->assign(rhs); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
544 |
return *this ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
545 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
546 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
547 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
548 |
// Assigns from another optional<T> (deep-copies the rhs value) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
549 |
// Basic Guarantee: If T::T( T const& ) throws, this is left UNINITIALIZED |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
550 |
// (NOTE: On BCB, this operator is not actually called and left is left UNMODIFIED in case of a throw) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
551 |
optional& operator= ( optional const& rhs ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
552 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
553 |
this->assign( rhs ) ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
554 |
return *this ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
555 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
556 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
557 |
// Assigns from a T (deep-copies the rhs value) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
558 |
// Basic Guarantee: If T::( T const& ) throws, this is left UNINITIALIZED |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
559 |
optional& operator= ( argument_type val ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
560 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
561 |
this->assign( val ) ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
562 |
return *this ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
563 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
564 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
565 |
// Assigns from a "none" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
566 |
// Which destroys the current value, if any, leaving this UNINITIALIZED |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
567 |
// No-throw (assuming T::~T() doesn't) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
568 |
optional& operator= ( none_t none_ ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
569 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
570 |
this->assign( none_ ) ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
571 |
return *this ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
572 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
573 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
574 |
// Returns a reference to the value if this is initialized, otherwise, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
575 |
// the behaviour is UNDEFINED |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
576 |
// No-throw |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
577 |
reference_const_type get() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
578 |
reference_type get() { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
579 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
580 |
// Returns a copy of the value if this is initialized, 'v' otherwise |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
581 |
reference_const_type get_value_or ( reference_const_type v ) const { return this->is_initialized() ? get() : v ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
582 |
reference_type get_value_or ( reference_type v ) { return this->is_initialized() ? get() : v ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
583 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
584 |
// Returns a pointer to the value if this is initialized, otherwise, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
585 |
// the behaviour is UNDEFINED |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
586 |
// No-throw |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
587 |
pointer_const_type operator->() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_ptr_impl() ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
588 |
pointer_type operator->() { BOOST_ASSERT(this->is_initialized()) ; return this->get_ptr_impl() ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
589 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
590 |
// Returns a reference to the value if this is initialized, otherwise, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
591 |
// the behaviour is UNDEFINED |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
592 |
// No-throw |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
593 |
reference_const_type operator *() const { return this->get() ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
594 |
reference_type operator *() { return this->get() ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
595 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
596 |
// implicit conversion to "bool" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
597 |
// No-throw |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
598 |
operator unspecified_bool_type() const { return this->safe_bool() ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
599 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
600 |
// This is provided for those compilers which don't like the conversion to bool |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
601 |
// on some contexts. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
602 |
bool operator!() const { return !this->is_initialized() ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
603 |
} ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
604 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
605 |
// Returns optional<T>(v) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
606 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
607 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
608 |
optional<T> make_optional ( T const& v ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
609 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
610 |
return optional<T>(v); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
611 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
612 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
613 |
// Returns optional<T>(cond,v) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
614 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
615 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
616 |
optional<T> make_optional ( bool cond, T const& v ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
617 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
618 |
return optional<T>(cond,v); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
619 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
620 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
621 |
// Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
622 |
// No-throw |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
623 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
624 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
625 |
BOOST_DEDUCED_TYPENAME optional<T>::reference_const_type |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
626 |
get ( optional<T> const& opt ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
627 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
628 |
return opt.get() ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
629 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
630 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
631 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
632 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
633 |
BOOST_DEDUCED_TYPENAME optional<T>::reference_type |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
634 |
get ( optional<T>& opt ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
635 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
636 |
return opt.get() ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
637 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
638 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
639 |
// Returns a pointer to the value if this is initialized, otherwise, returns NULL. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
640 |
// No-throw |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
641 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
642 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
643 |
BOOST_DEDUCED_TYPENAME optional<T>::pointer_const_type |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
644 |
get ( optional<T> const* opt ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
645 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
646 |
return opt->get_ptr() ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
647 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
648 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
649 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
650 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
651 |
BOOST_DEDUCED_TYPENAME optional<T>::pointer_type |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
652 |
get ( optional<T>* opt ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
653 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
654 |
return opt->get_ptr() ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
655 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
656 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
657 |
// Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
658 |
// No-throw |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
659 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
660 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
661 |
BOOST_DEDUCED_TYPENAME optional<T>::reference_const_type |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
662 |
get_optional_value_or ( optional<T> const& opt, BOOST_DEDUCED_TYPENAME optional<T>::reference_const_type v ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
663 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
664 |
return opt.get_value_or(v) ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
665 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
666 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
667 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
668 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
669 |
BOOST_DEDUCED_TYPENAME optional<T>::reference_type |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
670 |
get_optional_value_or ( optional<T>& opt, BOOST_DEDUCED_TYPENAME optional<T>::reference_type v ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
671 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
672 |
return opt.get_value_or(v) ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
673 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
674 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
675 |
// Returns a pointer to the value if this is initialized, otherwise, returns NULL. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
676 |
// No-throw |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
677 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
678 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
679 |
BOOST_DEDUCED_TYPENAME optional<T>::pointer_const_type |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
680 |
get_pointer ( optional<T> const& opt ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
681 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
682 |
return opt.get_ptr() ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
683 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
684 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
685 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
686 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
687 |
BOOST_DEDUCED_TYPENAME optional<T>::pointer_type |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
688 |
get_pointer ( optional<T>& opt ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
689 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
690 |
return opt.get_ptr() ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
691 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
692 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
693 |
// optional's relational operators ( ==, !=, <, >, <=, >= ) have deep-semantics (compare values). |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
694 |
// WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointess() in generic code instead. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
695 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
696 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
697 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
698 |
// optional<T> vs optional<T> cases |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
699 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
700 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
701 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
702 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
703 |
bool operator == ( optional<T> const& x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
704 |
{ return equal_pointees(x,y); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
705 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
706 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
707 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
708 |
bool operator < ( optional<T> const& x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
709 |
{ return less_pointees(x,y); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
710 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
711 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
712 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
713 |
bool operator != ( optional<T> const& x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
714 |
{ return !( x == y ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
715 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
716 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
717 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
718 |
bool operator > ( optional<T> const& x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
719 |
{ return y < x ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
720 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
721 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
722 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
723 |
bool operator <= ( optional<T> const& x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
724 |
{ return !( y < x ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
725 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
726 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
727 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
728 |
bool operator >= ( optional<T> const& x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
729 |
{ return !( x < y ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
730 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
731 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
732 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
733 |
// optional<T> vs T cases |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
734 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
735 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
736 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
737 |
bool operator == ( optional<T> const& x, T const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
738 |
{ return equal_pointees(x, optional<T>(y)); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
739 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
740 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
741 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
742 |
bool operator < ( optional<T> const& x, T const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
743 |
{ return less_pointees(x, optional<T>(y)); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
744 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
745 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
746 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
747 |
bool operator != ( optional<T> const& x, T const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
748 |
{ return !( x == y ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
749 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
750 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
751 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
752 |
bool operator > ( optional<T> const& x, T const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
753 |
{ return y < x ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
754 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
755 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
756 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
757 |
bool operator <= ( optional<T> const& x, T const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
758 |
{ return !( y < x ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
759 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
760 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
761 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
762 |
bool operator >= ( optional<T> const& x, T const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
763 |
{ return !( x < y ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
764 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
765 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
766 |
// T vs optional<T> cases |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
767 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
768 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
769 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
770 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
771 |
bool operator == ( T const& x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
772 |
{ return equal_pointees( optional<T>(x), y ); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
773 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
774 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
775 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
776 |
bool operator < ( T const& x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
777 |
{ return less_pointees( optional<T>(x), y ); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
778 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
779 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
780 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
781 |
bool operator != ( T const& x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
782 |
{ return !( x == y ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
783 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
784 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
785 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
786 |
bool operator > ( T const& x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
787 |
{ return y < x ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
788 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
789 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
790 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
791 |
bool operator <= ( T const& x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
792 |
{ return !( y < x ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
793 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
794 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
795 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
796 |
bool operator >= ( T const& x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
797 |
{ return !( x < y ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
798 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
799 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
800 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
801 |
// optional<T> vs none cases |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
802 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
803 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
804 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
805 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
806 |
bool operator == ( optional<T> const& x, none_t ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
807 |
{ return equal_pointees(x, optional<T>() ); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
808 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
809 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
810 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
811 |
bool operator < ( optional<T> const& x, none_t ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
812 |
{ return less_pointees(x,optional<T>() ); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
813 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
814 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
815 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
816 |
bool operator != ( optional<T> const& x, none_t y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
817 |
{ return !( x == y ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
818 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
819 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
820 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
821 |
bool operator > ( optional<T> const& x, none_t y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
822 |
{ return y < x ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
823 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
824 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
825 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
826 |
bool operator <= ( optional<T> const& x, none_t y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
827 |
{ return !( y < x ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
828 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
829 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
830 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
831 |
bool operator >= ( optional<T> const& x, none_t y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
832 |
{ return !( x < y ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
833 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
834 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
835 |
// none vs optional<T> cases |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
836 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
837 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
838 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
839 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
840 |
bool operator == ( none_t x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
841 |
{ return equal_pointees(optional<T>() ,y); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
842 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
843 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
844 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
845 |
bool operator < ( none_t x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
846 |
{ return less_pointees(optional<T>() ,y); } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
847 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
848 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
849 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
850 |
bool operator != ( none_t x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
851 |
{ return !( x == y ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
852 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
853 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
854 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
855 |
bool operator > ( none_t x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
856 |
{ return y < x ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
857 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
858 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
859 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
860 |
bool operator <= ( none_t x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
861 |
{ return !( y < x ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
862 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
863 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
864 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
865 |
bool operator >= ( none_t x, optional<T> const& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
866 |
{ return !( x < y ) ; } |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
867 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
868 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
869 |
// The following swap implementation follows the GCC workaround as found in |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
870 |
// "boost/detail/compressed_pair.hpp" |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
871 |
// |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
872 |
namespace optional_detail { |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
873 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
874 |
// GCC < 3.2 gets the using declaration at namespace scope (FLC, DWA) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
875 |
#if BOOST_WORKAROUND(__GNUC__, < 3) \ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
876 |
|| BOOST_WORKAROUND(__GNUC__, == 3) && __GNUC_MINOR__ <= 2 |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
877 |
using std::swap; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
878 |
#define BOOST_OPTIONAL_STD_SWAP_INTRODUCED_AT_NS_SCOPE |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
879 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
880 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
881 |
// optional's swap: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
882 |
// If both are initialized, calls swap(T&, T&). If this swap throws, both will remain initialized but their values are now unspecified. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
883 |
// If only one is initialized, calls U.reset(*I), THEN I.reset(). |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
884 |
// If U.reset(*I) throws, both are left UNCHANGED (U is kept uinitialized and I is never reset) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
885 |
// If both are uninitialized, do nothing (no-throw) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
886 |
template<class T> |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
887 |
inline |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
888 |
void optional_swap ( optional<T>& x, optional<T>& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
889 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
890 |
if ( !x && !!y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
891 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
892 |
x.reset(*y); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
893 |
y.reset(); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
894 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
895 |
else if ( !!x && !y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
896 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
897 |
y.reset(*x); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
898 |
x.reset(); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
899 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
900 |
else if ( !!x && !!y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
901 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
902 |
// GCC > 3.2 and all other compilers have the using declaration at function scope (FLC) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
903 |
#ifndef BOOST_OPTIONAL_STD_SWAP_INTRODUCED_AT_NS_SCOPE |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
904 |
// allow for Koenig lookup |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
905 |
using std::swap ; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
906 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
907 |
swap(*x,*y); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
908 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
909 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
910 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
911 |
} // namespace optional_detail |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
912 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
913 |
template<class T> inline void swap ( optional<T>& x, optional<T>& y ) |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
914 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
915 |
optional_detail::optional_swap(x,y); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
916 |
} |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
917 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
918 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
919 |
} // namespace boost |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
920 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
921 |
#endif |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
922 |