wrote:
> Ok this shouldn't be nearly this hard, but i've checked EVERYWHERE from
> msdn to scouring google & I can't figure it out.
>
> I basically have a vector of pointers to "aaWord" objects, each of
> which contain titles (as strings) and I want to order the vector
> alphabetically by those strings. I'm using __gc and pointers and all
> that. Visual C++ .NET
>
> vector<gcroot<aaWord __gc*> > *VectorofWords;
>
> Since obviously ordinary sort wouldn't work, I tried making my own
> predicate function looking like
>
> static bool op_LessThan( aaWord* a, aaWord* b ){...}
>
> but it throws a Fatal Error C1001 INTERNAL COMPILER ERROR and there's
> no way i'm getting through that.
>
> Am I just making a stupid syntax error?
>
Since you've not provided even a simplified section of code. Perhaps
the sample below will help.
std::string str[6] = { "for", "all", "the", "tea", "in", "china" };
bool scmp(std::string *p1,std::string *p2)
{
return p1->compare(*p2) > 0;
}
void VTest(void)
{
std::vector<std::string *> vs;
std::string *ps = str + sizeof(str)/sizeof(*str);
do
{
--ps;
vs.push_back(ps);
}
while (ps != str);
std::vector<std::string *>::iterator it = vs.end();
do
{
--it;
std::cout << (*it)->c_str() << " ";
}
while (it != vs.begin());
std::sort(vs.begin(),vs.end(),&scmp);
std::cout << std::endl;
it = vs.end();
do
{
--it;
std::cout << (*it)->c_str() << " ";
}
while (it != vs.begin());
std::cout << std::endl;
}
JB