Opened 7 years ago

Closed 7 years ago

#12050 closed Support Requests (invalid)

error C2668: 'boost::begin' : ambiguous call to overloaded function

Reported by: greatsaurav@… Owned by:
Milestone: To Be Determined Component: None
Version: Boost 1.34.1 Severity: Problem
Keywords: Cc: greatsaurav@…

Description

Dear team,

Could you please help me to get rid of the below mentioned error/warnings. 1.error C2668: 'boost::begin' : ambiguous call to overloaded function 2.error C2668: 'boost::end' : ambiguous call to overloaded function 3.error C2780: '_OutTy *std::transform(_InIt1,_InIt1,_InTy (&)[_InSize],_OutTy (&)[_OutSize],_Fn2)' : expects 5 arguments - 4 provided 4.error C2780: '_OutTy *std::transform(_InIt1,_InIt1,_InIt2,_OutTy (&)[_OutSize],_Fn2)' : expects 5 arguments - 4 provided 5.error C2780: '_OutIt std::transform(_InIt1,_InIt1,_InTy (&)[_InSize],_OutIt,_Fn2)' : expects 5 arguments - 4 provided 6.error C2780: '_OutIt std::transform(_InIt1,_InIt1,_InIt2,_OutIt,_Fn2)' : expects 5 arguments - 4 provided 7.warning C4244: 'argument' : conversion from 'int64' to 'int', possible loss of data

I am using boost_1_34_1(as it required for project need)

Change History (11)

comment:1 by John Maddock, 7 years ago

You need to specify what code causes the errors and which boost library you are using.

in reply to:  1 ; comment:2 by anonymous, 7 years ago

Replying to johnmaddock:

You need to specify what code causes the errors and which boost library you are using.

This is one of the piece of code:-

Library: 1.34.1 1.

template<typename WritableRangeT>

inline void to_lower(

WritableRangeT& Input, const std::locale& Loc=std::locale())

{

std::transform(

begin(Input), end(Input), begin(Input), ::boost::algorithm::detail::to_lowerF<

typename range_value<WritableRangeT>::type >(Loc));

}

2.

in reply to:  2 ; comment:3 by anonymous, 7 years ago

Replying to anonymous:

Replying to johnmaddock:

You need to specify what code causes the errors and which boost library you are using.

This is one of the piece of code:-

Library: 1.34.1 1.

template<typename WritableRangeT>

inline void to_lower(

WritableRangeT& Input, const std::locale& Loc=std::locale())

{

std::transform(

begin(Input), end(Input), begin(Input), ::boost::algorithm::detail::to_lowerF<

typename range_value<WritableRangeT>::type >(Loc));

}

2.

comment:4 by John Maddock, 7 years ago

Boost-1.34 is ancient, I doubt you'll get much help there.

And the code you posted still doesn't provide something we can reproduce with (ie a self contained test case), or indicate which boost library is causing the issue for you.

in reply to:  3 comment:5 by greatsaurav@…, 7 years ago

The code shows error in case_conv.hpp. And I had pasted the piece of code too(above ). Our project requirement is to use Boost-1.34 only. So I am using it.

I am not able to understand that what info you want from me to get rid of this issue.

Note:- I had done copied boost 1_34_1 to "c:\Program Files (x86)\boost\" folder.

Do we have to do something else to use full fledged boost library ?

comment:6 by Michel Morin, 7 years ago

I am not able to understand that what info you want from me to get rid of this issue.

ADL depends on the type of arguments, but that info is missing in this ticket. So we cannot reproduce the error. Also note that, since some compilers have bugs, it is helpful for developers to know what compiler (and which version) is used.

Unfortunately, Boost 1.34 is too old so you may get only a little help (even if you provide enough info) as John said. But anyway, here's a possible fix:

boost::begin (end) itself is not a customization point, so don't use it as an unqualifed call (i.e. begin(Input)); if you intend to use boost::begin, qualify begin with boost:: (i.e. boost::begin(Input)).

See the bottom of this page.

comment:7 by anonymous, 7 years ago

I am using Microsoft Visual Studio Professional 2012. Version 11.0.50727.1 RTMREL

comment:8 by anonymous, 7 years ago

Could you please suggest some good IDE/Compiler where we can execute the code.

comment:9 by Michel Morin, 7 years ago

My guess is that the problem is caused by the ambiguity between boost::begin and std::begin. If that's the case, then a solution would be

  1. Use more recent versions of Boost.
  2. Add boost:: before begin (and end).
  3. Use compilers (stdlibs) without std::begin, e.g. VS 2010.

If not, I can't be more helpful.

comment:10 by John Maddock, 7 years ago

Indeed, and unless a self-contained test case is forthcoming, I suggest we close the issue.

comment:11 by Michel Morin, 7 years ago

Resolution: invalid
Severity: ShowstopperProblem
Status: newclosed

So let's close the ticket for now.

I also note that the ADL issue is already resolved in both Boost.StringAlgo and Boost.Range.

Note: See TracTickets for help on using tickets.