Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
narrowing.hpp File Reference

Utilities for safe type narrowing conversions. More...

#include "shambase/SourceLocation.hpp"
#include "shambase/exception.hpp"
#include "shambase/stacktrace.hpp"
#include "shambase/string.hpp"
#include "shambase/type_traits.hpp"
#include <limits>
#include <stdexcept>
Include dependency graph for narrowing.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  shambase
 namespace for basic c++ utilities

Functions

template<class U, class T>
constexpr bool shambase::can_narrow (T val)
 Check if an integer value can be safely narrowed to a target type.
template<class U, class T>
shambase::narrow_or_throw (T val, SourceLocation &&callsite=SourceLocation{})

Detailed Description

Utilities for safe type narrowing conversions.

Author
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)

Definition in file narrowing.hpp.