MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / throw_or_mimic

Function throw_or_mimic

Source/Utils/cxxopts.hpp:532–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

530
531 template <typename T>
532 void throw_or_mimic(const std::string& text)
533 {
534 static_assert(std::is_base_of<std::exception, T>::value,
535 "throw_or_mimic only works on std::exception and "
536 "deriving classes");
537
538#ifndef CXXOPTS_NO_EXCEPTIONS
539 // If CXXOPTS_NO_EXCEPTIONS is not defined, just throw
540 throw T{text};
541#else
542 // Otherwise manually instantiate the exception, print what() to stderr,
543 // and exit
544 T exception{text};
545 std::cerr << exception.what() << std::endl;
546 std::exit(EXIT_FAILURE);
547#endif
548 }
549
550 namespace values
551 {

Callers

nothing calls this directly

Calls 1

whatMethod · 0.45

Tested by

no test coverage detected