Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hateful compiler, just nasty, awful

Status
Not open for further replies.

joeGrammar

Programmer
Jun 4, 2001
162
CA
I'm assuming this is a template problem, or a problem with setting up the pointer_to_binary_function object, but anyhoo we'll see what we can do...

fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1794)

Occurs:

void SortElements( int (*fCmp)( const TCPtr*ppe1,const TCPtr *ppe2 ) )
{
sort( vector<T*>::begin(), vector<T*>::end(),
----> qsort2sort(std::ptr_fun(fCmp)) );
}
(where ptr_fun is a pointer_to_binary_function)

where qsort2sort:

template <class DataType>
QsortCmpToSortLess<DataType>
qsort2sort(const std::pointer_to_binary_function<const DataType *,const DataType *, int>& qSrtCmp)
{
return QsortCmpToSortLess<DataType>(qSrtCmp);
}

and QsortCmpToSortLess is a class:

template <class DataType>
class QsortCmpToSortLess
: public std::binary_function<DataType, DataType, bool>
{
protected:
typedef std::pointer_to_binary_function<const DataType *,const DataType *, int> FunPtr;
FunPtr qSrtCmp;
public:
typedef DataType second_argument_type;
typedef DataType first_argument_type;
typedef bool result_type;
explicit QsortCmpToSortLess (const FunPtr& x) : qSrtCmp(x) {}
bool operator() (const first_argument_type& x,
const second_argument_type& y) const
{
return qSrtCmp( &x, &y) < 0 ? true : false;
}
};

Anyways any help would be appreciated for this is one HATED error :) Thanks
 
Upon closer inspection it appears to be this line which is causing the error

const std::pointer_to_binary_function<const DataType *,const DataType *, int>& qSrtCmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top