我想为某个类型实现移动构造函数(没有复制构造函数),这个类型需要是boost :: unordered_map中的值类型.我们称之为复合型.
Composite具有以下签名:
struct Base { Base(..stuff,no default ctor) : initialization list {} Base(Base&& other) : initialization list {} } struct Composite { Base member; Composite(..stuff,no default ctor) : member(...) {} Composite(Composite&& other) : member(other.member) {} // <---- I want to make sure this invokes the move ctor of Base }
我想写这个,所以boost :: unordered_map< Key,Composite>不需要复制构造函数,只使用移动构造函数.如果可能的话,我不想在Composite的移动构造函数的初始化列表中使用Base的复制构造函数.
这可能吗?
解决方法
原文地址:https://www.jb51.cc/c/110671.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。