"typename" in set1.hh when using Visual Studio 2005 beta
Posted by: Roger Garrett
Date: June 22, 2005 09:59AM

PROBLEM:

When compiling the MySQL API for C++using Visual Studio 2005 beta a compiler error occurs within the set1.hh file at the point where the following code exists:

template <class T>
inline MysqlSetInsert<set<T> > set_insert(set<T> *o) {
return MysqlSetInsert<set<T> >(o);
}

The CORRECTION to this problem resides farther up in the file where the word "typename" is commented out (i.e. it looks like /* typename */ ), in two places.
In particular, in these two sections of code:

template <class T, class value_type = /* typename */ T::value_type>
class MysqlListInsert {
private:
T *object;
public:
MysqlListInsert(T *o) {object = o;}
void operator () (const value_type &data) {object->push_back(data);}
};

template <class T, class key_type = /* typename */ T::key_type>
class MysqlSetInsert {
private:
T *object;
public:
MysqlSetInsert(T *o) {object = o;}
void operator () (const key_type &data) {object->insert(data);}
};

TO CORRECT THE PROBLEM, simply un-comment-out the "typename" words, so that you end up with:

template <class T, class value_type = typename T::value_type>
class MysqlListInsert {
private:
T *object;
public:
MysqlListInsert(T *o) {object = o;}
void operator () (const value_type &data) {object->push_back(data);}
};

template <class T, class key_type = typename T::key_type>
class MysqlSetInsert {
private:
T *object;
public:
MysqlSetInsert(T *o) {object = o;}
void operator () (const key_type &data) {object->insert(data);}
};


That solves THAT problem. Unfortunately, there is still a problem with Visual Studio 2005 beta in that, although it appears to compile each of the individual files successfully, the compiler nonetheless returns a failure code, with a request to report it to Microsoft, but no specific information as to what went wrong.

I'm still working on that part.

If anyone has any insights, please let me know.

Roger Garrett

Options: ReplyQuote


Subject
Views
Written By
Posted
"typename" in set1.hh when using Visual Studio 2005 beta
871
June 22, 2005 09:59AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.