forked from martinmoene/optional-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptional-main.t.h
43 lines (28 loc) · 904 Bytes
/
optional-main.t.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2016 Martin Moene
//
// https://github.com/martinmoene/optional-lite
//
// This code is licensed under the MIT License (MIT).
#pragma once
#ifndef TEST_OPTIONAL_LITE_H_INCLUDED
#define TEST_OPTIONAL_LITE_H_INCLUDED
#include "optional.hpp"
#include "lest_cpp03.hpp"
using namespace nonstd;
#define CASE( name ) lest_CASE( specification(), name )
extern lest::tests & specification();
namespace nonstd { namespace optional_lite {
// use oparator<< instead of to_string() overload;
// see http://stackoverflow.com/a/10651752/437272
template< typename T >
inline std::ostream & operator<<( std::ostream & os, optional<T> const & v )
{
using lest::to_string;
return os << "[optional:" << (v ? to_string(*v) : "[empty]") << "]";
}
}}
namespace lest {
using ::nonstd::optional_lite::operator<<;
} // namespace lest
#endif // TEST_OPTIONAL_LITE_H_INCLUDED
// end of file