我不明白为什么这不起作用(Visual C++ 2012):
#include <string>
#include <utility>
#include <vector>
#include <boost/assign/list_of.hpp>
using namespace std;
int main()
{
pair<string, vector<string> >("^", boost::assign::list_of<string>("rules"));
}
错误是:
include\utility(138) : error C2668: 'std::vector<_Ty>::vector' : ambiguous call to overloaded function with [ _Ty=std::string ]
include\vector(786): could be 'std::vector<_Ty>::vector(std::vector<_Ty> &&)' with [ _Ty=std::string ]
include\vector(693): or 'std::vector<_Ty>::vector(unsigned int)' with [ _Ty=std::string ]
while trying to match the argument list '(boost::assign_detail::generic_list<T>)' with [ T=std::string ]
test.cpp(12) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2>::pair<const char(&)[2],boost::assign_detail::generic_list<T>>(_Other1,_Other2 &&,void **)' being compiled
with
[
_Ty1=std::string,
_Ty2=std::vector<std::string>,
T=std::string,
_Other1=const char (&)[2],
_Other2=boost::assign_detail::generic_list<std::string>
]
test.cpp(12) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2>::pair<const char(&)[2],boost::assign_detail::generic_list<T>>(_Other1,_Other2 &&,void **)' being compiled
with
[
_Ty1=std::string,
_Ty2=std::vector<std::string>,
T=std::string,
_Other1=const char (&)[2],
_Other2=boost::assign_detail::generic_list<std::string>
]
我无法破译为什么它试图访问unsigned int
重载......有什么想法吗?