1#ifndef QUGAR_LIBRARY_UTILS_HPP
2#define QUGAR_LIBRARY_UTILS_HPP
16#include <initializer_list>
22template<
class T,
class V>
constexpr T
narrow_cast(V &&val)
noexcept
24 return static_cast<T
>(std::forward<V>(val));
22template<
class T,
class V>
constexpr T
narrow_cast(V &&val)
noexcept {
…}
30template<
class T, std::
size_t N>
32constexpr T &
at(T (&arr)[N],
const index ind)
32constexpr T &
at(T (&arr)[N],
const index ind) {
…}
38template<
class Cont>
constexpr auto at(Cont &cont,
const index ind) ->
decltype(cont[cont.size()])
41 using size_type =
decltype(cont.size());
38template<
class Cont>
constexpr auto at(Cont &cont,
const index ind) ->
decltype(cont[cont.size()]) {
…}
45template<
class T>
constexpr T
at(
const std::initializer_list<T> cont,
const index ind)
48 return *(cont.begin() + ind);
45template<
class T>
constexpr T
at(
const std::initializer_list<T> cont,
const index ind) {
…}
51template<
class T, std::
size_t extent = std::dynamic_extent>
52constexpr auto at(std::span<T, extent> spn,
const index ind) ->
decltype(spn[spn.size()])
52constexpr auto at(std::span<T, extent> spn,
const index ind) ->
decltype(spn[spn.size()]) {
…}
QUGaR's main namespace.
Definition affine_transf.hpp:28
constexpr T & at(T(&arr)[N], const index ind)
Definition utils.hpp:32
constexpr T narrow_cast(V &&val) noexcept
Definition utils.hpp:22
std::ptrdiff_t index
Definition types.hpp:19