Template Struct Vec< 3, T >#

Struct Documentation#

template<typename T>
struct Vec<3, T>#

Struct for a 3-dimensional vector.

Public Types

using value_type = T#
using pointer = value_type*#
using const_pointer = const value_type*#
using reference = value_type&#
using const_reference = const value_type&#
using iterator = std::array<T, 3>::iterator#
using const_iterator = std::array<T, 3>::const_iterator#
using size_type = u32#
using difference_type = isize#
using reverse_iterator = std::array<T, 3>::reverse_iterator#
using const_reverse_iterator = std::array<T, 3>::const_reverse_iterator#

Public Functions

constexpr Vec() noexcept = default#

Constructor.

constexpr Vec(const Vec &v) noexcept = default#

Copy constructor.

explicit constexpr Vec(T scalar) noexcept#
constexpr Vec(T x_, T y_, T z_) noexcept#
template<typename X, typename Y, typename Z>
inline constexpr Vec(X x_, Y y_, Z z_) noexcept#
template<typename A, typename B>
inline constexpr Vec(const Vec<2, A> &xy, B z_) noexcept#
template<typename A, typename B>
inline constexpr Vec(A x_, const Vec<2, B> &yz) noexcept#
template<typename U>
inline explicit constexpr Vec(const Vec<4, U> &v) noexcept#
template<typename U>
inline explicit constexpr Vec(const Vec<3, U> &v) noexcept#
constexpr Vec(Vec&&) noexcept = default#

Move constructor.

constexpr ~Vec() = default#

Destructor.

constexpr Vec<3, T> &operator=(Vec&&) noexcept = default#

Move assignment operator.

constexpr T &x() noexcept#

Retrieve the x component of the vector.

Returns:

x component.

constexpr const T &x() const noexcept#

Retrieve the x component of the vector.

Returns:

x component.

constexpr T &y() noexcept#

Retrieve the y component of the vector.

Returns:

y component.

constexpr const T &y() const noexcept#

Retrieve the y component of the vector.

Returns:

y component.

constexpr T &z() noexcept#

Retrieve the z component of the vector.

Returns:

z component.

constexpr const T &z() const noexcept#

Retrieve the z component of the vector.

Returns:

z component.

constexpr T &operator[](usize i) noexcept#

Returns a reference to the element at specified location i.

Note

No bounds checking is performed.

Parameters:

i – Position of the element to return.

Returns:

Reference to the requested element.

constexpr const T &operator[](usize i) const noexcept#

Returns a constant reference to the element at specified location i.

Note

No bounds checking is performed.

Parameters:

i – Position of the element to return.

Returns:

Constant reference to the requested element.

constexpr T &at(usize i)#

Returns a reference to the element at specified location i, with bounds checking via asserts.

Parameters:

i – Position of the element to return.

Returns:

Reference to the requested element.

constexpr const T &at(usize i) const#

Returns a constant reference to the element at specified location i, with bounds checking via asserts.

Parameters:

i – Position of the element to return.

Returns:

Constant reference to the requested element.

constexpr const_iterator begin() const noexcept#

Returns an iterator to the first element of the vector.

Returns:

Iterator to the first element.

constexpr iterator begin() noexcept#

Returns an iterator to the first element of the vector.

Returns:

Iterator to the first element.

constexpr const_iterator cbegin() const noexcept#

Returns an iterator to the first element of the vector.

Returns:

Iterator to the first element.

constexpr const_reverse_iterator rbegin() const noexcept#

Returns a reverse iterator to the first element of the reversed vector. It corresponds to the last element of the non-reversed vector.

Returns:

Reverse iterator to the first element.

constexpr reverse_iterator rbegin() noexcept#

Returns a reverse iterator to the first element of the reversed vector. It corresponds to the last element of the non-reversed vector.

Returns:

Reverse iterator to the first element.

constexpr const_reverse_iterator crbegin() const noexcept#

Returns a reverse iterator to the first element of the reversed vector. It corresponds to the last element of the non-reversed vector.

Returns:

Reverse iterator to the first element.

constexpr const_iterator end() const noexcept#

Returns an iterator to the element following the last element of the vector.

Note

This element acts as a placeholder; attempting to access it results in undefined behaviour.

Returns:

Iterator to the element following the last element.

constexpr iterator end() noexcept#

Returns an iterator to the element following the last element of the vector.

Note

This element acts as a placeholder; attempting to access it results in undefined behaviour.

Returns:

Iterator to the element following the last element.

constexpr const_iterator cend() const noexcept#

Returns an iterator to the element following the last element of the vector.

Note

This element acts as a placeholder; attempting to access it results in undefined behaviour.

Returns:

Iterator to the element following the last element.

constexpr const_reverse_iterator rend() const noexcept#

Returns a reverse iterator to the element following the last element of the reversed vector. It corresponds to the element preceding the first element of the non-reversed vector.

Note

This element acts as a placeholder; attempting to access it results in undefined behaviour.

Returns:

Reverse iterator to the element following the last element.

constexpr reverse_iterator rend() noexcept#

Returns a reverse iterator to the element following the last element of the reversed vector. It corresponds to the element preceding the first element of the non-reversed vector.

Note

This element acts as a placeholder; attempting to access it results in undefined behaviour.

Returns:

Reverse iterator to the element following the last element.

constexpr const_reverse_iterator crend() const noexcept#

Returns a reverse iterator to the element following the last element of the reversed vector. It corresponds to the element preceding the first element of the non-reversed vector.

Note

This element acts as a placeholder; attempting to access it results in undefined behaviour.

Returns:

Reverse iterator to the element following the last element.

constexpr Vec<3, T> &operator=(const Vec<3, T> &v) noexcept = default#

Copy assignment operator.

template<typename U>
inline constexpr Vec<3, T> &operator=(const Vec<3, U> &v) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator+=(U scalar) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator+=(const Vec<3, U> &v) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator-=(U scalar) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator-=(const Vec<3, U> &v) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator*=(U scalar) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator*=(const Vec<3, U> &v) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator/=(U scalar) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator/=(const Vec<3, U> &v) noexcept#
constexpr Vec<3, T> &operator++() noexcept#
constexpr Vec<3, T> &operator--() noexcept#
constexpr const Vec<3, T> operator++(i32) noexcept#
constexpr const Vec<3, T> operator--(i32) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator%=(U scalar) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator%=(const Vec<3, U> &v) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator&=(U scalar) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator&=(const Vec<3, U> &v) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator|=(U scalar) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator|=(const Vec<3, U> &v) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator^=(U scalar) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator^=(const Vec<3, U> &v) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator<<=(U scalar) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator<<=(const Vec<3, U> &v) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator>>=(U scalar) noexcept#
template<typename U>
inline constexpr Vec<3, T> &operator>>=(const Vec<3, U> &v) noexcept#
consteval auto operator<=>(const Vec<3, T> &rhs) const noexcept = delete#
inline constexpr void Swap(Vec<3, T> &other) noexcept(std::is_nothrow_move_constructible_v<Vec<3, T>> && std::is_nothrow_move_assignable_v<Vec<3, T>>)#

Public Static Functions

static constexpr usize Length() noexcept#

Retrieve the count of components of the vector.

Returns:

Count of components.