如何检查范围的元素是否应该移动?

问题描述

一个类似的问题:check if elements of a range can be moved?

我不认为其中的答案是一个很好的解决方案。实际上,它需要对所有容器进行部分专业化。


我尝试过,但我不确定检查 operator*() 是否足够。

// RangeType

using IteratorType = std::iterator_t<RangeType>;
using Type = decltype(*(std::declval<IteratorType>()));

constexpr bool canMove = std::is_rvalue_reference_v<Type>;

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)