aboutsummaryrefslogtreecommitdiff
path: root/src/utility.h
blob: 63424206e976bae11b749f74f8b26cdc3ddfe83e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef TRIE_SRC_UTILITY_H_
#define TRIE_SRC_UTILITY_H_

namespace detail {

template <
	typename Value
>
struct Result {
	Result():
		value_(false, Value()) { }

	Result(Value value):
		value_(true, value) { }

	inline operator bool() const {
		return this->value_.first;
	}

	inline Value get() const {
		return this->value_.second;
	}

	const std::pair<bool, Value> value_;
};

}

#endif  // TRIE_SRC_UTILITY_H_