Stroika Library 3.0d21
 
Loading...
Searching...
No Matches
Stroika::Foundation::Execution::Activity< STRINGISH_T > Class Template Referencefinal

#include <Activity.h>

Inheritance diagram for Stroika::Foundation::Execution::Activity< STRINGISH_T >:
Stroika::Foundation::Execution::Private_::Activities_::AsStringObj_

Public Member Functions

constexpr Activity (const STRINGISH_T &arg)
 

Detailed Description

template<convertible_to< Characters::String > STRINGISH_T = Characters::String>
class Stroika::Foundation::Execution::Activity< STRINGISH_T >

An Activity is typically a static const or sometimes even constexpr object which contains a description of an ongoing activity. They are generally not meant to be stored or copied, but REFERENCED with DeclareActivity to form a 'current activity stack'.

Example Usage
static constexpr Activity kBuildingThingy_{ "building thingy"sv };
static const auto kOtherActivity = Activity<String>{ "abc" };
// automatic variable activity OK as long as it's lifetime longer than reference in DeclareActivity
auto otherActivity = Activity<String> { "abc" + argument }; // activities can be stack based, but these cost more to define
auto lazyEvalActivity = LazyEvalActivity ([&] () -> String { return argument.Repeat (5) + "x"; });
// then for how to use activity object - see DeclareActivity
Note
the intended purpose of this is to provide better 'context' for default exception messages, when exceptions are created/thrown.
See also
CaptureCurrentActivities
Note
for now, constexpr Activity<wstring_view> kActivity; // FAILS This is because AsStringObj_ has a virtual destructor (necessary for other types). That's crazy because constexpr objects are never destroyed, so its crazy to care that they have a virtual DTOR. Still, g++ and msvc both agree on this; I think this MAYBE fixed in C++20 (not yet tested) - because there they at least allow virtual constexpr methods. That might impact (indirectly) whether an object can be constexpr (having a virtual dtor).

Definition at line 62 of file Activity.h.

Constructor & Destructor Documentation

◆ Activity()

template<convertible_to< Characters::String > STRINGISH_T>
requires (is_array_v<STRINGISH_T>)
constexpr Stroika::Foundation::Execution::Activity< STRINGISH_T >::Activity ( const STRINGISH_T &  arg)
constexpr

Definition at line 13 of file Activity.inl.


The documentation for this class was generated from the following files: