C++11: Got rid of narrowing conversion warnings in legacy code.

Added explicit static_cast along with static SFINAE checks to VectorT
constructor.
This commit is contained in:
Hans-Christian Ebke
2015-11-09 22:55:42 +01:00
parent 26914cba92
commit dda4b41cac
2 changed files with 21 additions and 2 deletions

View File

@@ -92,6 +92,23 @@ namespace OpenMesh {
//== CLASS DEFINITION =========================================================
#if CPP11_ENABLED
/*
* Helpers for VectorT
*/
namespace {
template<typename... Ts>
struct are_convertible_to;
template<typename To, typename From, typename... Froms>
struct are_convertible_to<To, From, Froms...> {
static constexpr bool value = std::is_convertible<From, To>::value && are_convertible_to<To, Froms...>::value;
};
template<typename To, typename From>
struct are_convertible_to<To, From> : public std::is_convertible<From, To> {};
}
#endif
/** The N values of the template Scalar type are the only data members
of the class VectorT<Scalar,N>. This guarantees 100% compatibility