Skip to content

Commit fe323f4

Browse files
dyn must be movable when using vector emplace_back
1 parent cd5304c commit fe323f4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tests/counters.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <simply/copyable.hpp>
22
#include <simply/destructible.hpp>
33
#include <simply/dyn.hpp>
4+
#include <simply/movable.hpp>
45

56
#include <algorithm>
67
#include <cassert>
@@ -11,7 +12,7 @@ template <char Label>
1112
struct counter {
1213
counter() = default;
1314
constexpr counter(const counter &other) : copied(other.copied + 1) {}
14-
counter(counter &&other) = delete;
15+
counter(counter &&other) noexcept = default;
1516

1617
auto operator=(const counter &) -> counter & = delete;
1718
auto operator=(counter &&) -> counter & = delete;
@@ -60,9 +61,9 @@ struct simply::iface<labeled<LabelT>, Self> {
6061

6162
// test dyn<countable> at compile-time
6263
static_assert([] {
63-
struct countable : simply::composes<copy_countable<int>, labeled<char>,
64-
simply::copyable, simply::destructible> {
65-
};
64+
struct countable
65+
: simply::composes<copy_countable<int>, labeled<char>, simply::copyable,
66+
simply::movable, simply::destructible> {};
6667

6768
// initialize a vector of dyn<countable> with three different counter types
6869
std::vector<simply::dyn<countable>> v;

tests/stream.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <simply/destructible.hpp>
22
#include <simply/dyn.hpp>
33
#include <simply/insertable.hpp>
4+
#include <simply/movable.hpp>
45

56
#include <gtest/gtest.h>
67

@@ -10,7 +11,7 @@ TEST(Stream, TypeErasedInsertion) {
1011
using namespace std::string_literals;
1112

1213
struct mixins : simply::composes<simply::insertable<std::ostream>,
13-
simply::destructible> {};
14+
simply::movable, simply::destructible> {};
1415

1516
std::vector<simply::dyn<mixins>> values;
1617
values.emplace_back("Hello, world!"s);

0 commit comments

Comments
 (0)