Top "Boost-optional" questions

A Boost C++ library that provides a container that can represent uninitialized objects of arbitrary type, notably allowing easier definition of functions that might not have a value to return

How to use boost::optional

I am trying to use boost::optional as below. #include <iostream> #include <string> #include <boost/…

c++ boost boost-optional
How should one use std::optional?

I'm reading the documentation of std::experimental::optional and I have a good idea about what it does, but I …

c++ boost-optional c++-tr2
How to set a boost::optional back to an uninitialized state?

How can I "reset"/"unset" a boost::optional? optional<int> x; if( x ) { // We won't hit this since …

c++ boost boost-optional
retrieving an object from boost::optional

Suppose a method returns something like this boost::optional<SomeClass> SomeMethod() {...} Now suppose I have something like this …

c++ boost boost-optional
Conversion of boost::optional to bool

How I can prevent the last line of this code from compiling? #include <boost/optional.hpp> int main() { …

c++ boost type-conversion boost-optional
std::optional specialization for reference types

Why std::optional (std::experimental::optional in libc++ at the moment) does not have specialization for reference types (compared with …

c++ c++11 stl optional boost-optional
boost::optional alternative in C++ Standard Library

I'm trying to get my program working without boost usage, but can't find an alternative of some useful patterns. Namely, …

c++ c++11 boost std boost-optional
How to get around GCC ‘*((void*)& b +4)’ may be used uninitialized in this function warning while using boost::optional

I have code similar to the following: #include <boost/optional.hpp> ::boost::optional<int> getitem(); int …

c++ boost g++ boost-optional
How to move from std::optional<T>

Consider the following example where we parse data and pass the result to the next function: Content Parse(const std::…

c++ std c++14 boost-optional
When to use boost::optional and when to use std::unique_ptr in cases when you want to implement a function that can return "nothing"?

From what I understand there are 2* ways you can implement a function that sometimes doesnt return a result(for example …

c++ boost c++11 unique-ptr boost-optional