有什么方法可以static_assert,模板参数是不可复制的
Is there any way to static_assert that template argument is noncopyable?
是否有任何方法可以确定某种类型在编译时间内不可仿制?我需要以下内容:
template<typename T, unsigned long long MaxSize>
struct circular_buffer : boost::noncopyable {
static_assert(typeof(T) ?????, "T must be noncopyable!");
};
c 11具有is_copy_assignable
和is_copy_constructible
类型特征。断言两个都是错误的。
相关文章:
- 简单可复制与可简单复制
- std::p ackaged_task 应该删除带有 const 参数的复制 c'tor
- reinterpret_cast,只读访问,简单的可复制类型,会出什么问题?
- 对于参加可复制和可移动类的访问者来说,应该有多少过载?
- 可变参数宏:无法通过"..."传递非平凡可复制类型的对象
- 为什么 std::atomic<std::string> 会给出微不足道的可复制错误?
- 我可以隐式地创建一个琐碎的可复制类型吗
- 是std::memcpy在不同的可复制类型之间的未定义行为
- 为什么一对常量是微不足道的可复制的,而对不是?
- 在一个微不足道的可复制结构中,移动语义应该实现吗?
- 是否可以仅通过传递指针作为参数来复制二叉搜索树?
- 防止作用域枚举可复制/可移动
- 别名一个模板函数,该功能没有参数可更简洁
- C :对象上的可复制视图
- 防御性地应用 std::move 到平凡可复制的类型是否不可取
- 为什么 std::function 本身是可复制构造的类型?
- C :通过STD :: simolor_ptr(仅移动类型)rvalue作为参数时复制ELISION
- C++不可复制的 lambda 的行为是可复制的
- 类型 traits,用于检查参数包中的所有类型是否都是可复制构造的
- 使用 std::string 参数和不可移动/可复制参数构建 std::map