No in MS Visual Studio 2013 - what to do?

前端 未结 3 1448
青春惊慌失措
青春惊慌失措 2020-12-10 14:00

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 base
相关标签:
3条回答
  • 2020-12-10 14:32

    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.

    0 讨论(0)
  • 2020-12-10 14:35

    I've found that this implementation compiles with MSVC2013. Note that only compiles, everything else isn't guaranteed.

    https://github.com/mapbox/variant/blob/master/include/mapbox/optional.hpp

    0 讨论(0)
  • 2020-12-10 14:38

    I was using this one for msvc2015 and it worked:

    https://raw.githubusercontent.com/akrzemi1/Optional/master/optional.hpp

    0 讨论(0)
提交回复
热议问题