Optional: Move optional-lite to the include/third-party directory

This fixes the use case of adding the include folder
manually to an outside project.
This commit is contained in:
Paul Hollinsky
2021-04-23 20:01:53 -04:00
parent b7ce9819bd
commit 6c1cbc9db8
44 changed files with 1 additions and 5 deletions
@@ -0,0 +1,36 @@
#include "nonstd/optional.hpp"
#include <iostream>
#include <vector>
using nonstd::optional;
struct V
{
int v;
V( int v )
: v( v ) {}
};
int main()
{
try
{
int x = 42;
// V s; // V has no default constructor
V t(x); // Ok
std::vector< optional<V> > v(3);
v[0] = t;
std::cout << "v[0].value().v: " << v[0].value().v << "\n";
std::cout << "v[1].value().v: " << v[1].value().v << "\n";
}
catch( std::exception const & e )
{
std::cout << "Error: " << e.what() << "\n";
}
}
// cl -nologo -W3 -EHsc -I../include 00-nodefltctor.cpp && 00-nodefltctor