aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/maybe.cpp
blob: 6ce4627190d38fccdb7736cf91ae7efc96eb6cc7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "maybe.h"
#include <util/system/type_name.h> 

[[noreturn]] void NMaybe::TPolicyUndefinedExcept::OnEmpty(const std::type_info& valueTypeInfo) { 
    ythrow yexception() << "TMaybe is empty, value type: "sv << TypeName(valueTypeInfo); 
}

[[noreturn]] void NMaybe::TPolicyUndefinedFail::OnEmpty(const std::type_info& valueTypeInfo) { 
    const TString typeName = TypeName(valueTypeInfo); 
    Y_FAIL("TMaybe is empty, value type: %s", typeName.c_str()); 
}

template <>
void Out<TNothing>(IOutputStream& o, const TNothing&) {
    o << "(empty maybe)";
}