FougTools  0.7.0dev-046fb6a
Handy tools for C++, Qt and OpenCascade
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
math::StdArrayVecAccessTag Struct Reference

Tag dispatch for vector coordinates to be accessed with a temporary std::array<> object. More...

#include <mathtools/vec_traits.h>

Inheritance diagram for math::StdArrayVecAccessTag:
math::VecAccessTag

Detailed Description

Tag dispatch for vector coordinates to be accessed with a temporary std::array<> object.

When none of the other tags can be used, then StdArrayVecAccessTag is the fallback access to vector coordinates. It has the penality of the creation of a temporary std::array<> object that will store the vector coordinates.

Example :

struct MyVector2D
{
double x;
double y;
};
namespace math {
template<> struct VecAccess<MyVector2D>
{
// Optional: required only for mutating algorithms
static void assign(MyVector2D& vec, const std::array<double, 2>& array)
{
vec.x = array.at(0);
vec.y = array.at(1);
}
static std::array<double, 2> stdarray(const MyVector2D& vec)
{
const std::array<double, 2> array = { vec.x, vec.y };
return array;
}
};
}

The documentation for this struct was generated from the following file: