aboutsummaryrefslogtreecommitdiff
path: root/tests/optional/driver.cxx
blob: e73f03e323c7bc80a91fd829cdd4ba766ef5d2bc (plain)
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
44
// file      : tests/optional/driver.cxx -*- C++ -*-
// license   : MIT; see accompanying LICENSE file

#ifndef __cpp_lib_modules_ts
#include <vector>
#include <utility>    // move()
#endif

// Other includes.

#ifdef __cpp_modules_ts
#ifdef __cpp_lib_modules_ts
import std.core;
#endif
import butl.optional;
#else
#include <libbutl/optional.mxx>
#endif

#undef NDEBUG
#include <cassert>

using namespace std;

struct move_only
{
  move_only () = default;

  move_only (move_only&&) = default;
  move_only& operator= (move_only&&) = default;

  move_only (const move_only&) = delete;
  move_only& operator= (const move_only&) = delete;
};

int
main ()
{
  using butl::optional;

  optional<move_only> r;
  vector<optional<move_only>> rs;
  rs.emplace_back (move (r));
}