folly
folly copied to clipboard
Error while implementing MPMCQueue of type cv::Mat
/MPMCQueue.h:635:52: error: static assertion failed: T must be relocatable or have a noexcept move constructor
635 | std::is_nothrow_constructible<T, T&&>::value ||
| ~~~~~~^~
636 | folly::IsRelocatable<T>::value,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/folly/MPMCQueue.h: In instantiation of ‘struct folly::detail::SingleElementQueue<cv::Mat, std::atomic>’:
/usr/local/include/folly/MPMCQueue.h:976:56: required from ‘class folly::detail::MPMCQueueBase<folly::MPMCQueue<cv::Mat, std::atomic, false> >’
/usr/local/include/folly/MPMCQueue.h:104:7: required from ‘class folly::MPMCQueue<cv::Mat, std::atomic, false>’
....... required from ‘class SmartCCTV::ProducerConsumer<cv::Mat>’
...... : required from here
/usr/local/include/folly/MPMCQueue.h:1330:8: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
1330 | void enqueue(
FWIW, the error is correct: OpenCV's cv::Mat
's move constructor is noexcept(false)
. I don't know if there's any good reason for that. I was bold and filed a feature request with OpenCV about this: https://github.com/opencv/opencv/issues/25065