Andrey Semashev
24d29e5865
Fix for clang, when adapted type is convertible from other types.
...
The problem was with copy/move constructors of boost::optional<T>, which invoked
optional_base<T> constructors with a single argument. Since optional_base has
copy/move constructors along with initializing constructors taking a single
argument, the latter may be considered by the compiler for viability. While
doing so, the compiler may instantiate the template constructor of T with
an argument of optional_base<T>, which in turn may fail if the constructor
attempts to inspect the type of its argument (e.g. to constrain the set of
acceptable types). Specifically, this happens with clang in C++03 mode,
when boost::multiprecision::number is wrapped in boost::optional and
a copy constructor of boost::optional is invoked.
This commit fixes the problem by destinguishing copy/move constructors of
optional_base from initializing constructors with an additional tag argument.
2018-11-04 17:35:10 +03:00
Nikita Kniazev
bebc606a4c
Remove deprecation mark from reset()
...
The `std::optional` has `reset()` [optional.mod] and it is not deprecated.
2018-10-23 22:34:10 +02:00
Andrzej Krzemienski
228b20df82
fixed old implementation (issue #57 )
2018-07-12 00:30:47 +02:00
Andrzej Krzemienski
71d797b9ee
added implementation and tests of flat_map()
2018-06-28 23:30:47 +02:00
Andrzej Krzemienski
e47a017009
added o.map()
2018-06-23 18:27:14 +02:00
Andrzej Krzemienski
5182f7f30f
Added has_value()
2018-03-24 00:04:15 +01:00
akrzemi1
76ff82d191
Silenced warning -Wzero-as-null-pointer-constant
2018-02-15 22:51:08 +01:00
Peter Klotz
a5aaf4d8d0
Fixed recurring typo
2018-02-11 21:03:54 +01:00
petamas
e230bd83c6
Fix compilation of template parameter with member enum T on VS2015
...
Issue: https://github.com/boostorg/optional/issues/46
2018-01-03 10:46:31 +01:00
Andrzej Krzemienski
fb54ee1741
Fixed spelling mistake in macros
2017-11-07 23:35:01 +01:00
Andrzej Krzemienski
f9fdf42a17
fix for the previous partial commit
2017-11-07 23:34:52 +01:00
Andrzej Krzemienski
06dea2cb9b
Reverted specialization for trivial types
...
It caused too many problems. I left only specialiation for scalar types.
I will need to devise clever type traits for reconizing trivial types with working constructor.
2017-11-07 23:34:34 +01:00
Andrzej Krzemienski
69bf75ae6d
Fix trivially-constructible bug with deleted functions
2017-11-07 23:34:26 +01:00
Andrzej Krzemienski
9d0ddc4709
fixed regression on compilers w/o type trait support
2017-11-07 23:34:18 +01:00
Andrzej Krzemienski
a7f33f5d6f
more defensive checking for trivial types -- avoiding bugs
2017-11-07 23:34:15 +01:00
Andrzej Krzemienski
58f7c2f14a
fix bug with defaulted move in msvc 12.0
2017-11-07 23:34:12 +01:00
Andrzej Krzemienski
2d2c3c3f6f
trivially-copyable optional<T> for trivial T
2017-11-07 23:34:05 +01:00
Andrey Semashev
e95f9fc254
Convert tabs to spaces.
2017-11-07 23:34:02 +01:00
Andrzej Krzemienski
4fe57f57fa
Fix make_optional for rvalues
2017-11-07 23:33:54 +01:00
Daniel J. Hofmann
c695be11b5
Adds forwarding make_optional helpers, resolves #30
2017-11-07 23:32:27 +01:00
Andrzej Krzemienski
d73b5110dd
corrected the compiler workarounds
2016-11-22 02:35:24 +01:00
Andrzej Krzemienski
b4907c2a51
old compiler workarounds for the previous two fixes
2016-11-20 23:42:41 +01:00
Andrzej Krzemienski
fafb3abb64
Implemented reset syntax: o = {}
2016-11-19 21:14:28 +01:00
Andrzej Krzemienski
7ea2ca6c40
Fix #12563
2016-11-19 14:57:40 +01:00
Andrzej Krzemienski
8d69e99e78
removed hack test, updated copyright
2016-11-06 01:49:53 +01:00
Andrzej Krzemienski
9bc1cc585c
small sfinae fix for in_place constructors
2016-11-02 22:28:20 +01:00
Andrzej Krzemieński
4e08f0dd41
Fixed build in C++03 compiler
2016-10-28 11:49:33 +02:00
Andrzej Krzemieński
9af24038bc
fixed initialization of in_place tags
2016-10-27 11:40:23 +02:00
Andrzej Krzemieński
92d40c7108
Fixed in_place_init tags
2016-10-27 09:21:24 +02:00
Andrzej Krzemienski
eb9ea1f72d
added in_place constructors
2016-10-27 01:08:17 +02:00
Andrzej Krzemienski
0831788c86
Removed enable_if factory on SUNPRO compilers
2016-03-05 23:22:29 +01:00
Andrzej Krzemienski
9118518516
more extensive speculative fix
2016-02-20 16:36:48 +01:00
Andrzej Krzemienski
c0084a0451
extended speculative fix to more MSVC compilers
2016-02-20 16:11:16 +01:00
Andrzej Krzemienski
3b58b0f4da
speculative fix for msvc 8.0 test failure
2016-02-20 11:34:18 +01:00
Andrzej Krzemienski
f6e09fbf9c
value constructor is sfinae-friendly
2016-02-19 18:41:42 +01:00
Andrzej Krzemienski
5ffa3fd2f6
turned a complicatedcondition in enable_if into a metafun
2016-02-19 01:51:08 +01:00
Andrzej Krzemieński
1671966380
fixed preprocessor typeo
2016-02-18 15:02:07 +01:00
Andrzej Krzemieński
b38b64cee9
extended destructor workaround to MSVC 10.0
2016-02-18 12:34:08 +01:00
Andrzej Krzemieński
7ae2db7312
Conditionally removing optional destructor
2016-02-18 11:00:24 +01:00
Andrzej Krzemieński
630fbb7973
re-added explicit optional destructor
...
If it is not there T::~T() is never called in buggy msvc-8.0.
2016-02-18 09:16:59 +01:00
Andrzej Krzemienski
c653372524
cleanup after separating references
2016-02-18 00:24:59 +01:00
Andrzej Krzemienski
87ef503606
Removed empty optional destructor
2016-02-17 16:39:07 +01:00
Andrzej Krzemienski
b5b8414c06
Primary template optional<> does not handle references
2016-02-13 00:46:41 +01:00
Andrzej Krzemienski
cf4b2e8b16
specialization for optional ref - preliminary
2015-10-05 16:54:05 +02:00
Andrzej Krzemienski
b43ce289c2
Fixed no-return warning
2015-06-03 18:22:41 +02:00
Andrzej Krzemienski
4e7405a233
Sane swap() for rvalue-aware compilers
...
When we detect that compiler supports rvalue references, we implement swap() in term of moves (as intuition suggests).
Otherwise we fall back to old tricks with default constructor+swap
2015-05-18 16:51:12 +02:00
Andrzej Krzemienski
8ca74951b0
Added emplace(void) for older compilers
2015-05-15 18:10:19 +02:00
drivehappy
1d7fe0e770
Removed unused parameters.
2015-04-21 14:37:41 -07:00
Andrzej Krzemienski
15d9fcdbd1
added missing overload for value_or fo non-C++11 compilers
2015-03-10 07:14:36 +01:00
Andrzej Krzemienski
0a8a798c3a
Fixed Trac #10839
2015-03-09 11:50:10 +01:00