|
(Note that these are not member functions.)
|
|
template<typename T , std::size_t N> |
| constexpr Vector< T, N > | abs (const Vector< T, N > &v) noexcept |
| | Absolute value function for vectors.
|
| |
|
template<typename T , std::size_t N> |
| constexpr bool | operator== (const Vector< T, N > &lhs, const Vector< T, N > &rhs) noexcept |
| | Equality operator.
|
| |
|
template<typename T , std::size_t N> |
| constexpr bool | operator!= (const Vector< T, N > &lhs, const Vector< T, N > &rhs) noexcept |
| | Inequality operator.
|
| |
|
template<typename T , std::size_t N> |
| constexpr std::enable_if_t< std::is_same< T, decltype(+T{})>::value, Vector< T, N > > | operator+ (Vector< T, N > v) noexcept |
| | Unary plus operator.
|
| |
|
template<typename T , std::size_t N> |
| constexpr std::enable_if_t< std::is_same< T, decltype(-T{})>::value, Vector< T, N > > | operator- (Vector< T, N > v) noexcept |
| | Unary negation operator.
|
| |
|
template<typename T , std::size_t N> |
| constexpr std::enable_if_t< std::is_same< T, decltype(T{}+T{})>::value, Vector< T, N > & > | operator+= (Vector< T, N > &lhs, const Vector< T, N > rhs) noexcept |
| | Increments the left hand side value by the right hand side value.
|
| |
|
template<typename T , std::size_t N> |
| constexpr std::enable_if_t< std::is_same< T, decltype(T{} - T{})>::value, Vector< T, N > & > | operator-= (Vector< T, N > &lhs, const Vector< T, N > rhs) noexcept |
| | Decrements the left hand side value by the right hand side value.
|
| |
|
template<typename T , std::size_t N> |
| constexpr std::enable_if_t< std::is_same< T, decltype(T{}+T{})>::value, Vector< T, N > > | operator+ (Vector< T, N > lhs, const Vector< T, N > rhs) noexcept |
| | Adds two vectors component-wise.
|
| |
|
template<typename T , std::size_t N> |
| constexpr std::enable_if_t< std::is_same< T, decltype(T{} - T{})>::value, Vector< T, N > > | operator- (Vector< T, N > lhs, const Vector< T, N > rhs) noexcept |
| | Subtracts two vectors component-wise.
|
| |
|
template<typename T1 , typename T2 , std::size_t N> |
| constexpr std::enable_if_t< std::is_same< T1, decltype(T1{} *T2{})>::value, Vector< T1, N > & > | operator*= (Vector< T1, N > &lhs, const T2 rhs) noexcept |
| | Multiplication assignment operator.
|
| |
|
template<typename T1 , typename T2 , std::size_t N> |
| constexpr std::enable_if_t< std::is_same< T1, decltype(T1{}/T2{})>::value, Vector< T1, N > & > | operator/= (Vector< T1, N > &lhs, const T2 rhs) noexcept |
| | Division assignment operator.
|
| |
| template<typename T1 , typename T2 , std::size_t A, std::size_t B, std::size_t C, typename OT = decltype(T1{} * T2{})> |
| constexpr std::enable_if_t< IsMultipliable< T1, T2 >::value, Vector< Vector< OT, C >, A > > | operator* (const Vector< Vector< T1, B >, A > &lhs, const Vector< Vector< T2, C >, B > &rhs) noexcept |
| | Calculates the matrix product of the two given vector of vectors (matrices). More...
|
| |
| template<std::size_t N, typename T1 , typename T2 , typename OT = decltype(T1{} * T2{})> |
| constexpr std::enable_if_t< IsMultipliable< T1, T2 >::value &&!IsVector< T1 >::value, Vector< OT, N > > | operator* (const T1 s, Vector< T2, N > a) noexcept |
| | Multiplication operator for non-vector times vector. More...
|
| |
| template<std::size_t N, typename T1 , typename T2 , typename OT = decltype(T1{} * T2{})> |
| constexpr std::enable_if_t< IsMultipliable< T1, T2 >::value &&!IsVector< T2 >::value, Vector< OT, N > > | operator* (Vector< T1, N > a, const T2 s) noexcept |
| | Multiplication operator for vector times non-vector. More...
|
| |
|
template<std::size_t N, typename T1 , typename T2 , typename OT = decltype(T1{} / T2{})> |
| constexpr std::enable_if_t< IsDivisable< T1, T2 >::value &&!IsVector< T2 >::value, Vector< OT, N > > | operator/ (Vector< T1, N > a, const T2 s) noexcept |
| | Division operator.
|
| |
|
template<std::size_t I, std::size_t N, typename T > |
| constexpr auto & | get (Vector< T, N > &v) noexcept |
| | Gets the specified element of the given collection.
|
| |
|
template<typename T , std::size_t N> |
| std::ostream & | operator<< (::std::ostream &os, const Vector< T, N > &value) |
| | Output stream operator.
|
| |
template<typename T, std::size_t N>
struct playrho::Vector< T, N >
Vector.
This is a constexpr and constructor enhanced std::array-like template class for types supporting the +, -, *, / arithmetic operators ("arithmetic types" as defined by the IsArithmetic type trait) that itself comes with non-member arithmetic operator support making Vector instances arithmetic types as well.
- Note
- This type is trivially default constructible - i.e. default construction performs no actions (no initialization).
- See also
- IsArithmetic, Vector Traits
- Examples
- Body.cpp, DistanceJoint.cpp, FrictionJoint.cpp, GearJoint.cpp, HelloWorld.cpp, Joint.cpp, MotorJoint.cpp, PrismaticJoint.cpp, PulleyJoint.cpp, RevoluteJoint.cpp, RopeJoint.cpp, Shape.cpp, TargetJoint.cpp, WeldJoint.cpp, WheelJoint.cpp, World.cpp, WorldBody.cpp, and WorldFixture.cpp.