stdoptional Questions
2
Why can't i use nullptr instead of nullopt? And why {} translates like nullopt?
Pillion asked 13/12, 2017 at 11:18
2
Solved
Now that std::experimental::optional has been accepted (or is about to be accepted), I wonder what is the overhead and the consequences on the assembly generated when the inner value is get by the ...
Ruffle asked 7/5, 2014 at 16:22
2
Solved
I have had runtime error, when replaced some code by using std::optional:
Old code:
T getValue();
...
const auto& value = getValue();
value.get();
New code:
std::optional<T> getValue...
Frenchpolish asked 14/9, 2017 at 12:34
1
Solved
std::optional::value() has the following two overloads
constexpr T& value() &;
constexpr const T & value() const &;
constexpr T&& value() &&;
constexpr const T&...
Insinuation asked 31/5, 2017 at 1:6
1
Solved
I am trying to use std::optional but my code raise error.
I have specified #include <experimental/optional> and compiler options are -std=c++1z, -lc++experimental.
How to use std::experiment...
Aiken asked 27/5, 2017 at 13:15
5
Solved
The reasoning of std::optional is made by saying that it may or may not contain a value. Hence, it saves us the effort of constructing a, probably, big object, if we don't need it.
For example, a...
Alo asked 21/3, 2017 at 14:22
2
Solved
I tried to compile the following program with different compilers (including gcc 6.1) :
#include <optional>
int main()
{
std::optional<int> o1;
}
Output is
main.cpp:1:20: fatal e...
Wraparound asked 7/7, 2016 at 19:39
© 2022 - 2025 — McMap. All rights reserved.