Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No <optional> in MS Visual Studio 2013 - what to do?

I want to use std::experimental::optional, but MSVS 2013 tells me it can't find the header.

  • Why isn't it there?
  • Can I roll my own based on code elsewhere? The C++14 proposal maybe?
like image 430
einpoklum Avatar asked Jul 17 '15 11:07

einpoklum


People also ask

How do I install Visual Studio components?

In the Visual Studio Installer, choose the Workloads tab, and then select or deselect the workloads that you want. To add more components than a workload installs, choose the Individual components tab, and then select or deselect the individual components that you want.

How do I know if Visual Studio is installed or not?

If you are running Windows 7, you can find the Visual Studio 2015 application at the top of the All Programs list grouped with other application icons. If you are running Windows 10, Windows 8.1, Windows 8 or Windows 11, you can find the icon listed under the V grouping.


1 Answers

std::experimental::optional originates from the Boost.Optional library, and this implementation works well in Visual C++ 12.0 (though it differs a little). Reference single-header implementation, based on the N3793 proposal paper, can be found here.

The latest list of supported C++11/14/1z core and library features that are shipped with Visual Studio can be found from the Visual C++ Team blog, from this post in particular. A set of header files of the Standard Library implementation (and some extensions) from Microsoft can be viewed here.

like image 79
Piotr Skotnicki Avatar answered Nov 28 '22 08:11

Piotr Skotnicki