[Clp] problems compiling Clp with gcc/g++ 3.3.5
Michael Hennebry
hennebry at web.cs.ndsu.nodak.edu
Wed Feb 11 14:06:42 EST 2009
On Wed, 11 Feb 2009, John J Forrest wrote:
> Thanks for pointing out the mistake.
You're welcome.
I think I got the reason wrong though.
The real reason (I think) is that string is itself a class template.
That (I think) makes all its methods function templates.
Matches obtained by template instantiation have to be exact matches.
The cast will produce an exact match.
> From: Michael Hennebry <hennebry at web.cs.ndsu.nodak.edu>
>
> To: Kish Shen <kisshen at cisco.com>
>
> Cc: clp at list.coin-or.org
>
> Date: 02/11/2009 12:52 AM
>
> Subject: Re: [Clp] problems compiling Clp with gcc/g++ 3.3.5
>
>
>
>
>
>
> On Tue, 10 Feb 2009, Kish Shen wrote:
>> CoinStructuredModel structured;
>> int numberBlocks=5;
>> for (int i=0;i<numberBlocks;i++) {
>> std::string topName="row_master";
>> std::string blockName="block_";
>> blockName.append(1,'a'+i);
>
> 'a'+1 is an int, but is probably intended to be a char.
> append is rather overloaded.
> I think that int to char is not one of the
> allowed conversions for overload resolution.
> None of the non-template methods matched,
> so the compiler inferred you wanted a template method,
> but that didn't match either.
> As the last thing tried, it got mentioned in the error message.
>
> An explicit cast should fix it.
--
Michael hennebry at web.cs.ndsu.NoDak.edu
"Pessimist: The glass is half empty.
Optimist: The glass is half full.
Engineer: The glass is twice as big as it needs to be."
More information about the Clp
mailing list