Modify base::convert_to() undefined implementation

GCC shows divide-by-zero warnings, so it is better in this way.
This commit is contained in:
David Capello 2013-09-21 20:40:54 -03:00
parent cde54f3682
commit 5d0c25b0da

View File

@ -17,7 +17,11 @@ namespace base {
// Undefined convertion
template<typename To, typename From>
To convert_to(const From& from) {
enum { not_supported = 1/(1 == 0) }; // static_assert(false)
// As this function doesn't return a value, if a specialization is
// not found, a compiler error will be thrown (which means that
// the conversion isn't supported).
// TODO Use a static_assert(false)
}
template<> int convert_to(const base::string& from);