Question: i have 

```
 class c1{

public:
    int number;

    c1()
    {
        number=rand()%10;
    }

    bool operator < (c1 *w)
    {
        return number < w->number;
    }

};

vector<c1*> vec = { ... }
sort(vec.begin(),vec.end()) 

```

why it dosent sort ?

but if we had 

```
 bool operator < (c1 w)
    {
        return number < w.number;
    }

```

and

```
vector<c1> vec = { ... }

```

it would have been sorted !

Answer: 
You need to pass a compare function to `std::sort`:

```
bool compare_c1 (c1* x, c1* y)
{
  return *x < y;
}

std::sort(v.begin(), v.end(), compare_c1);

```

Or if you are using GCC >= 4.5 or Visual Studio 2010 (I'm do not know sure about Intel compiler) you can use lambdas (they are part of the C++0x standard):

```
std::sort(v.begin(), v.end(), [] (c1* x, c1* y) { return *x < y; });

```
Add a external operator< and keep de original one:

```
bool operator<(c1* a, c1* b) { return *a < *b; } 

```

Now sort will work on the vector.