Commit 26914cba authored by Hans-Christian Ebke's avatar Hans-Christian Ebke
Browse files

C++11: Legacy incompatibility fixes for VectorT C++11 features.

parent c2c627ed
......@@ -80,6 +80,7 @@
#ifdef CPP11_ENABLED
#include <array>
#include <initializer_list>
#include <type_traits>
#endif
//== NAMESPACES ===============================================================
......
......@@ -98,11 +98,11 @@ public:
inline VectorT() {}
#ifdef CPP11_ENABLED
explicit inline VectorT(const Scalar& v) {
explicit inline VectorT(const Scalar &v) {
vectorize(v);
}
template<typename... T>
template<typename... T, typename = typename std::enable_if<sizeof...(T) == DIM>::type>
constexpr VectorT(T... vs) : Base {vs...}
{ }
#else
......@@ -154,9 +154,10 @@ public:
}
#endif
#endif
/// construct from a value array (explicit)
explicit inline VectorT(const Scalar _values[DIM]) {
memcpy(Base::values_, _values, DIM*sizeof(Scalar));
memcpy(data(), _values, DIM*sizeof(Scalar));
}
......@@ -196,11 +197,19 @@ public:
// /// cast to const Scalar array
// inline operator const Scalar*() const { return Base::values_; }
#ifdef CPP11_ENABLED
/// access to Scalar array
inline Scalar* data() { return Base::values_.data(); }
/// access to const Scalar array
inline const Scalar*data() const { return Base::values_.data(); }
#else
/// access to Scalar array
inline Scalar* data() { return Base::values_; }
/// access to const Scalar array
inline const Scalar*data() const { return Base::values_; }
#endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment