Problem setting population sorting on MSVC

Allan Findlay allan at zedtwo.com
Fri Dec 13 03:25:24 EST 2002


If its the last line then I assume you have 2 (or more) order() functions
which the compiler can't decide between.


The MSVC help files have a help entry for all the errors, C2663 says this:-

------------------------------------------------------------

'function' : number overloads have no legal conversions for 'this' pointer

The compiler could not convert the this pointer to any of the overloaded
versions of the member function.

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.

The following is an example of this error:

class C {
public:
   void foo() volatile;
   void foo(); // adding const here would fix problem
};

const C *pcc;

void main()
{
   pcc->foo();      // error
}

------------------------------------------------------------


-----------
    Allan

-----Original Message-----
From: Fredric V. Echols [mailto:rwf at gpcom.net] 
Sent: 10 December 2002 21:45
To: galib at mit.edu
Subject: Problem setting population sorting on MSVC


Hello everyone,

    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 "lower is
better" mode, I get this from MSVC 6.0:

"error C2663: 'order' : 2 overloads have no legal conversion for 'this'
pointer"

    Here is the relevant code:

---
// Genome type
#define GenomeT unsigned char
#define GAGenomeT GA1DArrayAlleleGenome<GenomeT>

// Allele set
GAAlleleSet<GenomeT> Allele(0, 255);

// Genome
GAGenomeT genome(2, Allele, Objective);

// Set up genome
genome.initializer(Initializer);

// GA
GASimpleGA ga(genome);

// Set sort order

ga.population().order(GAPopulation::LOW_IS_BEST);

---

    The last line is where the problem lies, according to the compiler.

    Thanks for your time!

-Fredric Echols

_______________________________________________
galib mailing list
galib at mit.edu
http://lancet.mit.edu/mailman/listinfo/galib
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/galib/attachments/20021213/a3cf2ffd/attachment.htm


More information about the galib mailing list