I have been banging my head against this and google for a while now so I hope it is alright to ask. I am still learning C++ and enjoying it but I don't full understand everything yet and am really just now digging into pointers and classes in my Data Structures class. Why can I not compare the fitness variables of the tree objects using this sort?

I am getting the error: 'Environment::compare': non-standard syntax; use '&' to create a pointer to member.

```
void Environment::evolve(const int popsize,const int maxgen) {
    std::cout << "> evolving function" << std::endl;

    std::vector<Tree> popvec;

    // Generate initial pop trees and store in array
    for (int i = 0; i <= popsize - 1; i++) {
        std::cout << "> generating initial population" << std::endl;

        Tree membertree;
        popvec.push_back(membertree);
    }

    // Loop for generations
    for (int j = 1; j <= maxgen; j++) {
        std::cout << "Generation " << j << ":" << std::endl;

        // sort array by fitness
        std::sort(popvec.begin(), popvec.end(), compare);

        // cull herd

        // reproduce

    }
}

bool Environment::compare(Tree obj1, Tree obj2) {
    return (obj1.fitness < obj2.fitness);
}

```

Thank you for your help.

Edit with header:

```
#include "Tree.h"

class Environment {
public:
    Environment();
    ~Environment();
    void evolve(const int popsize,const int maxgen);
    bool compare(Tree obj1, Tree obj2);

private:
    Tree* poparray;
};

```