1 | // |
2 | // immer: immutable data structures for C++ |
3 | // Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente |
4 | // |
5 | // This software is distributed under the Boost Software License, Version 1.0. |
6 | // See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt |
7 | // |
8 | |
9 | // Thanks Guiguiprim for reporting this issue |
10 | // https://github.com/arximboldi/immer/issues/46 |
11 | |
12 | #include <immer/flex_vector.hpp> |
13 | #include <immer/vector.hpp> |
14 | #include <immer/vector_transient.hpp> |
15 | |
16 | #include <catch.hpp> |
17 | |
18 | #if IMMER_CXX_STANDARD >= 17 |
19 | |
20 | #include <variant> |
21 | |
22 | TEST_CASE("error when erasing an element from a immer::flex_vector<std::variant/optional/any>" ) |
23 | { |
24 | using Vector = immer::flex_vector<std::variant<int, double>>; |
25 | // using Vector = immer::flex_vector<std::optional<int>>; |
26 | // using Vector = immer::flex_vector<std::any>; |
27 | |
28 | Vector v{1, 2, 3, 4}; |
29 | Vector v2 = v.erase(2); |
30 | |
31 | CHECK(v2.size() == 3); |
32 | } |
33 | |
34 | #endif |
35 | |