14 template<
typename... More>
16 using Tuple = std::tuple<More...>;
22 std::tuple_element_t<idx, Tuple> &
get() noexcept {
23 return std::get<idx>(m_members);
28 const std::tuple_element_t<idx, Tuple> &
get()
const noexcept {
29 return std::get<idx>(m_members);
33 template<
size_t idx,
typename Arg>
34 void set(Arg &&val) noexcept {
35 std::get<idx>(m_members) = std::forward<Arg>(val);
40 std::apply([](
auto &... args) { ((args = {}), ...); }, m_members);
51 template<
typename... More>
67 requires (std::is_convertible_v<T, std::string_view>) {
68 m_lastError = std::forward<T>(str);
75 const std::string &
lastError() const & noexcept {
return m_lastError; }
78 std::string m_lastError;
86 template<
typename... More>
112 std::string
lastError() const noexcept {
return m_lastError.str(); }
115 std::ostringstream m_lastError;
Stores a string (usually an error string) to be retrieved later.
Definition: LastError.h:87
LastErrorStream & reset() noexcept
Wipe out everything.
Definition: LastError.h:90
void resetMembers() noexcept
Wipe out members.
Definition: LastError.h:39
const std::string & lastError() const &noexcept
Obtain the stored string.
Definition: LastError.h:75
Stores a string (usually an error string) to be retrieved later.
Definition: LastError.h:52
LastErrorStream & operator<<(const T &x)
Store something into this error.
Definition: LastError.h:103
LastErrorStr & reset() noexcept
Wipe out everything.
Definition: LastError.h:55
std::string lastError() const noexcept
Obtain the stored string.
Definition: LastError.h:112
A base class for LastErrorStr and LastErrorStream.
Definition: LastError.h:15
void setError(T &&str) requires(std
Store a string into this error.
Definition: LastError.h:66