aboutsummaryrefslogtreecommitdiff
path: root/tests/optional/driver.cxx
blob: 63254b5a3ed864b578f164dcbd668a47b3d7081e (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
45
46
47
48
49
50
51
// file      : tests/optional/driver.cxx -*- C++ -*-
// license   : MIT; see accompanying LICENSE file

#include <vector>
#include <string>
#include <utility>    // move(), pair

#include <libbutl/optional.hxx>

#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));
  }

  // See https://github.com/libstud/libstud-optional/issues/1 for details.
  //
#if 0
  {
    vector<pair<string, optional<string>>> options;
    auto add = [&options] (string o, optional<string> v = {})
    {
      options.emplace_back (move (o), move (v));
    };

    add ("-usb");
    add ("-device", "usb-kbd");
  }
#endif
}