mardi 5 juin 2018

Iterators and trivial assignment/destructor

I tried to use boost::lockfree:queue to queue iterators, but the compilation fails on the static_assert (Debug Mode only)

boost::has_trivial_destructor::value

and

boost::has_trivial_assign::value

Code:

using list_it_t = typename std::list<Elem<T, dimens>>::iterator;
[...]
boost::lockfree::queue<list_it_t> iterators(1024);

Where Elem is a POD type, but afaik the behaviour is reproducible with other iterators as well.

I always thought that iterators fullfil both conditions?! In what way are they not trivially assignable or destructable?

Can I somehow still work with iterators or do I have to change to pointers on the elements? I'm iterating over the list and pushing iterators on the queue to be processed by other threads.

Specification:

  • MSVC v141
  • Boost 1.65

Aucun commentaire:

Enregistrer un commentaire