Hello, i use this framework with VS8, and if i include ootl_map.hpp i recive this error: C2226: syntax error : unexpected type 'T' in file ootl_misc.hpp line 116 by sourcecode:
template<typename T> const T& min(const T& x, const T& y) { // <-- this line with error! return x < y ? x : y;
}
template<typename T> const T& max(const T& x, const T& y) { return x > y ? x : y;
Your problem comes from the fact that Microsoft VS already defines min and max as macros. Therefore you cannot use these names as function names. You should rather use tmin and tmax or anything else.
> Hello, > i use this framework with VS8, and if i include ootl_map.hpp i recive > this error: > C2226: syntax error : unexpected type 'T' > in file ootl_misc.hpp line 116 by sourcecode:
> template<typename T> > const T& min(const T& x, const T& y) { // <-- this line with error! > return x < y ? x : y; > }
> template<typename T> > const T& max(const T& x, const T& y) { > return x > y ? x : y; > }
> Your problem comes from the fact that Microsoft VS already defines min > and max as macros. Therefore you cannot use these names as function > names. You should rather use tmin and tmax or anything else.
> Eric
> break a écrit :
> > Hello, > > i use this framework with VS8, and if i include ootl_map.hpp i recive > > this error: > > C2226: syntax error : unexpected type 'T' > > in file ootl_misc.hpp line 116 by sourcecode:
> > template<typename T> > > const T& min(const T& x, const T& y) { // <-- this line with error! > > return x < y ? x : y; > > }
> > template<typename T> > > const T& max(const T& x, const T& y) { > > return x > y ? x : y; > > }
> > can someone help me to solve this?
> > Thanks for any help! > > regards > > break- Hide quoted text -
Hello, yes i change the names already, but thanks! Can you give me a sample how to use hash_map? I have an error when i want to define my map variable! Here is a sample code: [code] // i have a own class derived from CObject called CMyObject ootl::hash_map<CString,CMyObject>myhashmap; // error C2512: 'ootl::hash_map<Key,Data>' : no appropriate default constructor available [/code]
How to create a varable from hash_map? Thansk in advance! regards break;
On 9 Okt., 12:02, leo_yvelines <eric.legr...@orange.fr> wrote:
> Your problem comes from the fact that Microsoft VS already defines min > and max as macros. Therefore you cannot use these names as function > names. You should rather use tmin and tmax or anything else.
> Eric
> break a écrit :
> > Hello, > > i use this framework with VS8, and if i include ootl_map.hpp i recive > > this error: > > C2226: syntax error : unexpected type 'T' > > in file ootl_misc.hpp line 116 by sourcecode:
> > template<typename T> > > const T& min(const T& x, const T& y) { // <-- this line with error! > > return x < y ? x : y; > > }
> > template<typename T> > > const T& max(const T& x, const T& y) { > > return x > y ? x : y; > > }
> or add #define NOMINMAX above the #include <windows.h>
> On Oct 9, 2:02 pm, leo_yvelines <eric.legr...@orange.fr> wrote:
> > Your problem comes from the fact that Microsoft VS already defines min > > and max as macros. Therefore you cannot use these names as function > > names. You should rather use tmin and tmax or anything else.
> > Eric
> > break a écrit :
> > > Hello, > > > i use this framework with VS8, and if i include ootl_map.hpp i recive > > > this error: > > > C2226: syntax error : unexpected type 'T' > > > in file ootl_misc.hpp line 116 by sourcecode:
> > > template<typename T> > > > const T& min(const T& x, const T& y) { // <-- this line with error! > > > return x < y ? x : y; > > > }