stdex
Additional custom or not Standard C++ covered algorithms
Loading...
Searching...
No Matches
common.hpp
1#pragma once
2
3#include <stdexcept>
4
5template <class T>
6void are_equal(const T& a, const T& b)
7{
8 if (!(a == b))
9 throw std::runtime_error("values are not equal");
10}
11
12template <class E, typename F>
13void expect_exception(F functor)
14{
15 try { functor(); }
16 catch (const E&) { return; }
17 throw std::runtime_error("exception expected");
18}