1 // Copyright (C) 2013-2018 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
24 mixin_counter() { ++counter
; }
25 mixin_counter(mixin_counter
const&) { ++counter
; }
26 ~mixin_counter() { --counter
; }
29 struct value_type
: private mixin_counter
31 value_type() = default;
32 value_type(int) : state(1) { }
33 value_type(std::initializer_list
<char>, const char*) : state(2) { }
39 using O
= gdb::optional
<value_type
>;
46 VERIFY( o
&& o
->state
== 0 );
49 O o
{ gdb::in_place
, 0 };
51 VERIFY( o
&& o
->state
== 0 );
57 VERIFY( o
&& o
->state
== 1 );
60 O o
{ gdb::in_place
};
62 VERIFY( o
&& o
->state
== 1 );
68 o
.emplace({ 'a' }, "");
69 VERIFY( o
&& o
->state
== 2 );
72 O o
{ gdb::in_place
};
73 o
.emplace({ 'a' }, "");
74 VERIFY( o
&& o
->state
== 2 );
79 VERIFY(&o
.emplace(0) == &*o
);
81 VERIFY(&o
.emplace({ 'a' }, "") == &*o
);
85 static_assert( !std::is_constructible
<O
, std::initializer_list
<int>, int>(), "" );
87 VERIFY( counter
== 0 );
90 } // namespace assign_6
This page took 0.03045 seconds and 4 git commands to generate.