1 // Copyright (C) 2013-2021 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
{ };
34 using O
= gdb::optional
<value_type
>;
36 // Check std::nullopt_t and 'default' (= {}) assignment
48 O o
{ gdb::in_place
};
64 O o
{ gdb::in_place
};
70 gdb::optional
<std::vector
<int>> ovi
{{1, 2, 3}};
71 VERIFY(ovi
->size() == 3);
72 VERIFY((*ovi
)[0] == 1 && (*ovi
)[1] == 2 && (*ovi
)[2] == 3);
74 VERIFY(ovi
->size() == 4);
75 VERIFY((*ovi
)[0] == 4 && (*ovi
)[1] == 5 &&
76 (*ovi
)[2] == 6 && (*ovi
)[3] == 7);
78 VERIFY( counter
== 0 );
81 } // namespace assign_5
This page took 0.044727 seconds and 4 git commands to generate.