This commit is contained in:
2019-08-09 12:01:01 +02:00
parent 8c40c02fc5
commit a3c5c16417
2 changed files with 12 additions and 23 deletions

View File

@ -107,6 +107,10 @@ template <class T, class Allocator = std::allocator<T>> class Result {
*/
T squash() const { return Squash(vec); }
/**
* If all elements are equal it returns the front value
* otherwise throws an exception with custom message provided
*/
T tsquash(const std::string &error_msg) {
if (equal())
return vec.front();