我如何将MPL地图插入
How do I insert into a Boost MPL map
我设法使用了boost mpl向量,列表很好,但我只是无法弄清楚地图。当我尝试将其插入一个时,我会从Clang 3.1中获得"太少的争论"(GCC 4.7说的类似)。有一个版本的插入物,第二个参数为pos,应该被忽略,所以我尝试在那里插入虚拟类型(int),但这只是给出了一个新的且令人困惑的错误。
include <iostream>
#include <boost/mpl/key_type.hpp>
#include <boost/mpl/map.hpp>
using namespace boost;
using namespace mpl;
int main(){
typedef pair<int_<3>, int_<6>> obj;
std::cout << key_type<map<>, obj >::type::value << std::endl; //works
std::cout << has_key<insert<map<>, obj>::type, obj)::type::value << std::endl; //complains on "too few template arguments for class template 'insert'
std::cout << has_key<insert<map<>, int, obj>::type, obj)::type::value << std::endl; // gives "implicit instantiation of undefined template 'boost::mpl::insert<..."
}
mpl错误即使有clang,也不是完全有帮助的,所以我只是不明白我在这里做错了什么?我确定这很愚蠢。
http://www.boost.org/doc/libs/1_51_0/libs/mpl/doc/refmanual/map.html
add
#include <boost/mpl/insert.hpp>
和正确的支架,从')'到'>'
http://liveworkspace.org/code/afb6632c3eb800412ea551f50c07fb0a
相关文章:
- 将一对插入地图并增加计数?
- 当我将其插入无序地图时,矢量的容量为 0
- 如何将元素插入到标准::地图的共享指针中?
- 无法插入到标准地图
- 为什么不插入地图?
- 为什么emplace_hint比插入地图慢?
- 地图插入(const_iterator提示,值)用法
- 无法将智能指针插入地图
- 插入到地图中,以对作为键并列出作为值
- 地图插入不明确
- VS 2017 错误 C2664 地图插入尝试
- 为什么通用参考概念不适用于函数指针的地图插入
- 地图插入将替换以前输入的值
- 地图插入密钥,但没有值
- 如何在CPU和内存中优化C 中的重型地图插入
- 我如何将MPL地图插入
- 地图::插入正在中断
- 我不明白地图插入上的此错误
- C++ 多重地图插入功能
- 地图插入返回错误答案的地图