Fix Visual Studio 2010 and Visual Studio 2012 compilation

- fix an overload operator ambiguity under MSVC2010, that is required for GCC
This commit is contained in:
Sébastien Rombauts 2012-11-04 20:43:17 +01:00
parent cffc0ae0d0
commit ede851eb3e
3 changed files with 9 additions and 2 deletions

View File

@ -62,11 +62,18 @@ public:
{ {
return getText(); return getText();
} }
#ifdef __GNUC__
// NOTE : the following is required by GCC to cast a Column result in a std::string
// (error: conversion from SQLite::Column to non-scalar type std::string {aka std::basic_string<char>} requested)
// but is not working under Microsoft Visual Studio 2010 and 2012
// (error C2440: 'initializing' : cannot convert from 'SQLite::Column' to 'std::basic_string<_Elem,_Traits,_Ax>'
// [...] constructor overload resolution was ambiguous)
/// Inline cast operator to std::string /// Inline cast operator to std::string
inline operator const std::string() const inline operator const std::string() const
{ {
return getText(); return getText();
} }
#endif
private: private:
// Column is copyable, but copy should not be used elsewhere than in return form getColumn // Column is copyable, but copy should not be used elsewhere than in return form getColumn

View File

@ -82,4 +82,4 @@ void Database::check(const int aRet) const // throw(SQLite::Exception)
} }
} }
}; // namespace SQLite } // namespace SQLite

View File

@ -223,4 +223,4 @@ void Statement::check(const int aRet) const // throw(SQLite::Exception)
} }
} }
}; // namespace SQLite } // namespace SQLite