Browse Source

Added VectorTypeFor and MatrixTypeFor aliases to DimensionTraits.

Also a new gem we can use with GCC 4.7.
pull/59/head
Vladimír Vondruš 12 years ago
parent
commit
5a020abb5f
  1. 32
      src/Magnum/DimensionTraits.h

32
src/Magnum/DimensionTraits.h

@ -25,16 +25,20 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#include "Magnum/Math/Math.h"
#include "Magnum/Types.h"
/** @file /** @file
* @brief Class @ref Magnum::DimensionTraits * @brief Class @ref Magnum::DimensionTraits, alias @ref Magnum::VectorTypeFor, @ref Magnum::MatrixTypeFor
*/ */
#include "Magnum/Math/Math.h"
#include "Magnum/Types.h"
namespace Magnum { namespace Magnum {
/** @brief Matrix and vector specializations for given dimension count */ /**
@brief Matrix and vector specializations for given dimension count
@see @ref VectorTypeFor, @ref MatrixTypeFor
*/
template<UnsignedInt dimensions, class T> struct DimensionTraits { template<UnsignedInt dimensions, class T> struct DimensionTraits {
DimensionTraits() = delete; DimensionTraits() = delete;
@ -58,10 +62,20 @@ template<UnsignedInt dimensions, class T> struct DimensionTraits {
}; };
/** /**
@todo `using VectorTypeForDimension<dimensions, T> = typename DimensionTraits<dimensions, T>::VectorType` @brief Vector type for given dimension count and type
etc. shortcuts when support for GCC 4.6 is dropped (similarly to what C++14
does with type traits) Convenience alternative to <tt>typename %DimensionTraits<dimensions, T>::%VectorType</tt>.
*/ See @ref DimensionTraits::VectorType for more information.
*/
template<UnsignedInt dimensions, class T> using VectorTypeFor = typename DimensionTraits<dimensions, T>::VectorType;
/**
@brief Matrix type for given dimension count and type
Convenience alternative to <tt>typename %DimensionTraits<dimensions, T>::%MatrixType</tt>.
See @ref DimensionTraits::MatrixType for more information.
*/
template<UnsignedInt dimensions, class T> using MatrixTypeFor = typename DimensionTraits<dimensions, T>::MatrixType;
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
/* One dimension */ /* One dimension */

Loading…
Cancel
Save