Browse Source

Math: revert ability to convert Vector<1, T> to T.

Doesn't solve problem I hoped it would solve (adding pointer and
Vector<1, size_t> still doesn't compile), breaks GCC 4.7 build in some
crazy way and makes certain previously-working operations (like
operator== on Vector<1, int> and int) ambiguous. Not worth pursuing
further, I think.

This reverts commit ca0892f026.
This reverts commit d6d0fd1890.
pull/136/head
Vladimír Vondruš 10 years ago
parent
commit
f3d774fa48
  1. 6
      src/Magnum/Math/Test/VectorTest.cpp
  2. 5
      src/Magnum/Math/Vector.h

6
src/Magnum/Math/Test/VectorTest.cpp

@ -214,11 +214,7 @@ void VectorTest::constructOneComponent() {
/* Implicit constructor must work */
constexpr Vector1 vec = 1.0f;
CORRADE_COMPARE(vec, Vector1{1.0f});
/* Conversion back must also work */
Float value = vec;
CORRADE_COMPARE(value, 1.0f);
CORRADE_COMPARE(vec, Vector1(1));
}
void VectorTest::constructConversion() {

5
src/Magnum/Math/Vector.h

@ -211,11 +211,6 @@ template<std::size_t size, class T> class Vector {
return Implementation::VectorConverter<size, T, U>::to(*this);
}
/** @brief Convert single-component vector to scalar value */
template<class U, std::size_t s = size, class = typename std::enable_if<s == 1>::type> constexpr /*implicit*/ operator U() const {
return *_data;
}
/**
* @brief Raw data
* @return One-dimensional array of `size` length.

Loading…
Cancel
Save