StackOverflow Questions for Tag: stdoptional

Ta Thanh Dinh
Ta Thanh Dinh

Reputation: 661

Return std::optional<T> where T's constructor is private

Score: 2

Views: 122

Answers: 2

Read More
H.v.M.
H.v.M.

Reputation: 1659

Why can't I assign an std::optional of std::lock_guard?

Score: 0

Views: 162

Answers: 2

Read More
whitwhoa
whitwhoa

Reputation: 2489

Are std::optional members stored contiguously?

Score: 7

Views: 3521

Answers: 2

Read More
Tomilov Anatoliy
Tomilov Anatoliy

Reputation: 16731

Why does std::optional not have a specialization for reference types?

Score: 67

Views: 61286

Answers: 6

Read More
Igor R.
Igor R.

Reputation: 15075

Function template call: type deduction and empty brace-enclosed initializer list

Score: 3

Views: 119

Answers: 2

Read More
Kamajii
Kamajii

Reputation: 1878

Casting std::optional inferior type

Score: 2

Views: 80

Answers: 1

Read More
The Quantum Physicist
The Quantum Physicist

Reputation: 26346

What's the advantage of `std::optional` over `std::shared_ptr` and `std::unique_ptr`?

Score: 15

Views: 15045

Answers: 6

Read More
αλεχολυτ
αλεχολυτ

Reputation: 5050

Undefined class while using __declspec(dllexport) since Visual Studio 17.2

Score: 1

Views: 165

Answers: 1

Read More
Igor G
Igor G

Reputation: 2471

Can I have a std::optional<T> if T is neither constructible nor copyable nor movable?

Score: 14

Views: 1042

Answers: 2

Read More
Eternal
Eternal

Reputation: 2959

When and why should I use std::monostate instead of std::optional with an std::variant?

Score: 6

Views: 1047

Answers: 3

Read More
einpoklum
einpoklum

Reputation: 132128

C++ equivalent of Javascript's '?.' operator for optional-chaining?

Score: 8

Views: 1674

Answers: 6

Read More
yairchu
yairchu

Reputation: 24804

Iterating over std::optional

Score: 3

Views: 1086

Answers: 3

Read More
JWCS
JWCS

Reputation: 1211

OpenCV C++ Temporary RValue Class Reference Invalidated by std::optional member?

Score: 0

Views: 42

Answers: 0

Read More
Vincent
Vincent

Reputation: 60451

Overhead of std::optional<T>?

Score: 19

Views: 19309

Answers: 2

Read More
thirdeye
thirdeye

Reputation: 302

Why `emplace()` without arguments returns 0?

Score: -5

Views: 374

Answers: 2

Read More
John
John

Reputation: 629

Is it possible to set an object to null?

Score: 58

Views: 185321

Answers: 7

Read More
Scott McPeak
Scott McPeak

Reputation: 12863

Is it ok to double-dereference ("**itOpt") an optional iterator?

Score: 3

Views: 91

Answers: 1

Read More
resnet
resnet

Reputation: 448

Does passing an std::optional<T> by reference actually save copying?

Score: 10

Views: 8016

Answers: 3

Read More
Vittorio Romeo
Vittorio Romeo

Reputation: 93364

`std::optional` factory function with guaranteed copy elision and `private` constructor, without passkey idiom

Score: 6

Views: 574

Answers: 1

Read More
Adel M.
Adel M.

Reputation: 408

Why is it undefined behavior to call operator* on an empty std::optional if I don't access the returned value right away?

Score: 3

Views: 169

Answers: 3

Read More
PreviousPage 1Next