<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: Problem setting population sorting on MSVC</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>If its the last line then I assume you have 2 (or more) order() functions which the compiler can't decide between.</FONT>
</P>
<BR>

<P><FONT SIZE=2>The MSVC help files have a help entry for all the errors, C2663 says this:-</FONT>
</P>

<P><FONT SIZE=2>------------------------------------------------------------</FONT>
</P>

<P><FONT SIZE=2>'function' : number overloads have no legal conversions for 'this' pointer</FONT>
</P>

<P><FONT SIZE=2>The compiler could not convert the this pointer to any of the overloaded versions of the member function.</FONT>
</P>

<P><FONT SIZE=2>This error may be caused by invoking a non-const member function on a const object. To correct the problem, remove the const from the object declaration or add const to one of the member function overloads.</FONT></P>

<P><FONT SIZE=2>The following is an example of this error:</FONT>
</P>

<P><FONT SIZE=2>class C {</FONT>
<BR><FONT SIZE=2>public:</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; void foo() volatile;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; void foo(); // adding const here would fix problem</FONT>
<BR><FONT SIZE=2>};</FONT>
</P>

<P><FONT SIZE=2>const C *pcc;</FONT>
</P>

<P><FONT SIZE=2>void main()</FONT>
<BR><FONT SIZE=2>{</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; pcc-&gt;foo();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // error</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>

<P><FONT SIZE=2>------------------------------------------------------------</FONT>
</P>
<BR>

<P><FONT SIZE=2>-----------</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; Allan</FONT>
</P>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Fredric V. Echols [<A HREF="mailto:rwf@gpcom.net">mailto:rwf@gpcom.net</A>] </FONT>
<BR><FONT SIZE=2>Sent: 10 December 2002 21:45</FONT>
<BR><FONT SIZE=2>To: galib@mit.edu</FONT>
<BR><FONT SIZE=2>Subject: Problem setting population sorting on MSVC</FONT>
</P>
<BR>

<P><FONT SIZE=2>Hello everyone,</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp; I am using a system in which a genetic algorithm is being used to produce signals, and the fitness function works by determining signal error using Mean Squared Error. Obviously, the lower the error, the better the genome is. Anyway, when I try to set the population to use the &quot;lower is better&quot; mode, I get this from MSVC 6.0:</FONT></P>

<P><FONT SIZE=2>&quot;error C2663: 'order' : 2 overloads have no legal conversion for 'this' pointer&quot;</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp; Here is the relevant code:</FONT>
</P>

<P><FONT SIZE=2>---</FONT>
<BR><FONT SIZE=2>// Genome type</FONT>
<BR><FONT SIZE=2>#define GenomeT unsigned char</FONT>
<BR><FONT SIZE=2>#define GAGenomeT GA1DArrayAlleleGenome&lt;GenomeT&gt;</FONT>
</P>

<P><FONT SIZE=2>// Allele set</FONT>
<BR><FONT SIZE=2>GAAlleleSet&lt;GenomeT&gt; Allele(0, 255);</FONT>
</P>

<P><FONT SIZE=2>// Genome</FONT>
<BR><FONT SIZE=2>GAGenomeT genome(2, Allele, Objective);</FONT>
</P>

<P><FONT SIZE=2>// Set up genome</FONT>
<BR><FONT SIZE=2>genome.initializer(Initializer);</FONT>
</P>

<P><FONT SIZE=2>// GA</FONT>
<BR><FONT SIZE=2>GASimpleGA ga(genome);</FONT>
</P>

<P><FONT SIZE=2>// Set sort order</FONT>
</P>

<P><FONT SIZE=2>ga.population().order(GAPopulation::LOW_IS_BEST);</FONT>
</P>

<P><FONT SIZE=2>---</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp; The last line is where the problem lies, according to the compiler.</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp; Thanks for your time!</FONT>
</P>

<P><FONT SIZE=2>-Fredric Echols</FONT>
</P>

<P><FONT SIZE=2>_______________________________________________</FONT>
<BR><FONT SIZE=2>galib mailing list</FONT>
<BR><FONT SIZE=2>galib@mit.edu</FONT>
<BR><FONT SIZE=2><A HREF="http://lancet.mit.edu/mailman/listinfo/galib" TARGET="_blank">http://lancet.mit.edu/mailman/listinfo/galib</A></FONT>
</P>

</BODY>
</HTML>