|
| template<class T, span_CONFIG_EXTENT_TYPE Extent = ::nonstd::dynamic_extent> |
| using | span = ::nonstd::span<T, Extent> |
| | A bounds-safe view for sequences of objects.
|
| |
|
using | extent_t = span_CONFIG_EXTENT_TYPE |
| | Span extent type.
|
| |
|
template<class T, typename Extent, typename Layout> |
| using | mdarray = MDSPAN_IMPL_STANDARD_NAMESPACE::Experimental::mdarray<T, Extent, Layout> |
| |
| template<typename T> |
| using | Array3D |
| |
|
template<class T, typename Extent, typename Layout> |
| using | mdspan = MDSPAN_IMPL_STANDARD_NAMESPACE::mdspan<T, Extent, Layout> |
| |
|
template<class IndexType, size_t... Extents> |
| using | extents = MDSPAN_IMPL_STANDARD_NAMESPACE::extents<IndexType, Extents...> |
| |
|
template<typename IndexType, size_t Rank> |
| using | dextents = MDSPAN_IMPL_STANDARD_NAMESPACE::dextents<IndexType, Rank> |
| |
|
using | layout_left = MDSPAN_IMPL_STANDARD_NAMESPACE::layout_left |
| |
|
using | layout_right = MDSPAN_IMPL_STANDARD_NAMESPACE::layout_right |
| |
|
using | layout_stride = MDSPAN_IMPL_STANDARD_NAMESPACE::layout_stride |
| |
|
using | full_extent_t = MDSPAN_IMPL_STANDARD_NAMESPACE::full_extent_t |
| |
|
template<typename T> |
| using | View3D = mdspan<T, dextents<size_t, 3>, layout_stride> |
| |
|
|
LA_CORE_API void | enable_fpe () |
| | Enable floating-point exceptions (useful for debugging).
|
| |
|
LA_CORE_API void | disable_fpe () |
| | Disable previously-enabled fpe.
|
| |
|
template<typename R, typename... Args> |
| constexpr void | swap (function_ref< R(Args...)> &lhs, function_ref< R(Args...)> &rhs) noexcept |
| | Swaps the referred callables of lhs and rhs.
|
| |
|
template<typename R, typename... Args> |
| | function_ref (R(*)(Args...)) -> function_ref< R(Args...)> |
| | Deduce function_ref type from a function pointer.
|
| |
| template<class T> |
| void | hash_combine (size_t &seed, const T &v) |
| | Hash an object v and combine it with an existing hash value seed.
|
| |
| template<typename T> |
| constexpr T | invalid () |
| | You can use invalid<T>() to get a value that can represent "invalid" values, such as invalid indices or invalid float data.
|
| |
| template<typename TargetType, typename SourceType> |
| constexpr auto | safe_cast (SourceType value) -> std::enable_if_t<!std::is_same< SourceType, TargetType >::value, TargetType > |
| | Perform safe cast from SourceType to TargetType, where "safe" means:
|
| |
| template<typename T> |
| constexpr T | safe_cast (T value) |
| | Safe cast specialization for TargetType == SourceType.
|
| |
| template<typename TargetType> |
| constexpr TargetType | safe_cast (bool value) |
| | Safe cast specialization for bool.
|
| |
| template<typename T, typename U> |
| constexpr T | safe_cast_enum (const U u) |
| | Casting an enum to scalar and vice versa.
|
| |
| template<typename Callback> |
| sg_detail::scope_guard< Callback > | make_scope_guard (Callback &&callback) noexcept(std::is_nothrow_constructible< Callback, Callback && >::value) |
| | Creates a scope guard around a callable object.
|
| |
| template<typename T, typename Y> |
| SharedSpan< T > | make_shared_span (const std::shared_ptr< Y > &r, T *element_ptr, size_t size) |
| | Created a SharedSpan object around an internal buffer of a parent object.
|
| |
| LA_CORE_API std::vector< std::string > | string_split (const std::string &str, char delimiter) |
| | Split a std::string using a prescribed delimiter.
|
| |
| LA_CORE_API bool | starts_with (std::string_view str, std::string_view prefix) |
| | Checks if the string begins with the given prefix.
|
| |
| LA_CORE_API bool | ends_with (std::string_view str, std::string_view suffix) |
| | Checks if the string ends with the given suffix.
|
| |
| LA_CORE_API std::string | to_lower (std::string str) |
| | Convert a string to lowercase.
|
| |
| LA_CORE_API std::string | to_upper (std::string str) |
| | Convert a string to uppercase.
|
| |
| template<typename... Args> |
| std::string | string_format (lagrange::format_string< Args... > format, Args &&... args) |
| | Format args according to the format string fmt, and return the result as a string.
|
| |
| template<class T, class... Args> |
| value_ptr< T > | make_value_ptr (Args &&... args) |
| | Helper function to create a value_ptr for a given type.
|
| |
| template<typename T> |
| Array3D< T > | create_image (size_t width, size_t height, size_t num_channels) |
| | Create an image with the given dimensions and number of channels.
|
| |
Useful functions that don't have their place anywhere else.
template<typename Callback>
| sg_detail::scope_guard< Callback > make_scope_guard |
( |
Callback && | callback | ) |
const && |
|
noexcept |
#include <lagrange/utils/scope_guard.h>
Creates a scope guard around a callable object.
A scope guard is an object that employs RAII to execute a provided callback when leaving scope, be it through a fall-through, a return, or an exception. That callback can be a function, a function pointer, a functor, a lambda, a bind result, a std::function, a reference to any of these, or any other callable, as long as it respects a few preconditions – most of which are enforced during compilation, the rest being hopefully intuitive.
- Parameters
-
| callback | Callable object to execute when leaving scope. |
- Template Parameters
-
| Callback | Callable object type. |
- Returns
- A scope guard object protecting the execution of the callable via RAII.