Template Function Cacao::Check(std::shared_ptr<P>, std::string, std::function<void()>)

Function Documentation

template<typename P, typename E>
void Cacao::Check(std::shared_ptr<P> ptr, std::string message, std::function<void()> unwindFn = []() {})

Checks if the shared_ptr contains a value, and throws an exception if not.

Parameters:
  • ptr – The shared_ptr to check for a value.

  • message – The human-readable message to print if the condition is false

  • unwindFn – A function to clean up state before exception throwing should the condition be false (to handle non-RAII-conformant stuff)