Skip to content

Instantly share code, notes, and snippets.

@jefftrull
Created February 10, 2014 03:50
Show Gist options
  • Save jefftrull/8910059 to your computer and use it in GitHub Desktop.
Save jefftrull/8910059 to your computer and use it in GitHub Desktop.
queue<shared_ptr<SimpleStruct>> is not nothrow move constructible
#include <queue>
#include <memory>
struct Foo {
int i;
};
using namespace std;
static_assert(is_nothrow_move_constructible<shared_ptr<Foo>>::value,
"Shared pointer is not move constructible");
static_assert(is_nothrow_move_constructible<queue<shared_ptr<Foo>>>::value,
"queue of shared pointers is not move constructible");
int main() {}
@jefftrull
Copy link
Author

Looks like the default underlying container deque<> is not, but if you supply a list<> as the second template parameter it will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment