|
Boost Users : |
Subject: [Boost-users] boost::xpressive Error 2668 call to amibous function
From: Jens Saathoff (jensesaat_at_[hidden])
Date: 2011-09-07 16:52:37
Hi!
I get the error C2668 if i try to compile the following code(xpressive
example from docs):
#include <string>
#include <iostream>
#include <boost/xpressive/xpressive.hpp>
#include <boost/xpressive/regex_actions.hpp>
#include <map>
using namespace boost::xpressive;
int main()
{
std::map<std::string, int> result;
std::string str("aaa=>1 bbb=>23 ccc=>456");
// Match a word and an integer, separated by =>,
// and then stuff the result into a std::map<>
sregex pair = ( (s1= +_w) >> "=>" >> (s2= +_d) )[ ref(result)[s1] =
as<int>(s2) ];
// Match one or more word/integer pairs, separated
// by whitespace.
sregex rx = pair >> *(+_s >> pair);
if(regex_match(str, rx))
{
std::cout << result["aaa"] << '\n';
std::cout << result["bbb"] << '\n';
std::cout << result["ccc"] << '\n';
}
return 0;
}
The complete error:
D:\Projekte\xpressive-test\main.cpp:29: Fehler:C2668:
'boost::xpressive::ref' : ambiguous call to overloaded function
D:\Frameworks\boost\boost_147\boost/xpressive/regex_actions.hpp(850):
could be 'const boost::xpressive::reference<T>
boost::xpressive::ref<std::map<_Kty,_Ty>>(T &)'
with
[
T=std::map<std::string,int>,
_Kty=std::string,
_Ty=int
]
C:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\INCLUDE\xrefwrap(439): or
'std::tr1::reference_wrapper<_Ty>
std::tr1::ref<std::map<_Kty,int>>(_Ty &)' [found using
argument-dependent lookup]
with
[
_Ty=std::map<std::string,int>,
_Kty=std::string
]
while trying to match the argument list '(std::map<_Kty,_Ty>)'
with
[
_Kty=std::string,
_Ty=int
]
What's the problem here?
Thank you very much!
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net