MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / Moveable

Class Moveable

tests/unittests/unittests.cpp:193–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191};
192
193struct Moveable {
194 Moveable(int id) : moved(false), copied(false), id(id) { }
195 Moveable(Moveable&& o) MOODYCAMEL_NOEXCEPT : moved(true), copied(o.copied), id(o.id) { }
196 void operator=(Moveable&& o) MOODYCAMEL_NOEXCEPT { moved = true; copied = o.copied; id = o.id; }
197 bool moved;
198 bool copied;
199 int id;
200
201#if defined(_MSC_VER) && _MSC_VER < 1800
202 // VS2012's std::is_nothrow_[move_]constructible is broken, so the queue never attempts to
203 // move objects with that compiler. In this case, we don't know whether it's really a copy
204 // or not being done, so give the benefit of the doubt (given the tests pass on other platforms)
205 // and assume it would have done a move if it could have (don't set copied to true).
206 Moveable(Moveable const& o) MOODYCAMEL_NOEXCEPT : moved(o.moved), copied(o.copied), id(o.id) { }
207 void operator=(Moveable const& o) MOODYCAMEL_NOEXCEPT { moved = o.moved; copied = o.copied; id = o.id; }
208#else
209 Moveable(Moveable const& o) MOODYCAMEL_NOEXCEPT : moved(o.moved), copied(true), id(o.id) { }
210 void operator=(Moveable const& o) MOODYCAMEL_NOEXCEPT { moved = o.moved; copied = true; id = o.id; }
211#endif
212};
213
214struct ThrowingMovable {
215 static std::atomic<int>& ctorCount() { static std::atomic<int> c; return c; }

Callers 1

full_apiMethod · 0.85

Calls

no outgoing calls

Tested by 1

full_apiMethod · 0.68