aboutsummaryrefslogtreecommitdiff
path: root/src/utility.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utility.h')
-rw-r--r--src/utility.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/utility.h b/src/utility.h
new file mode 100644
index 0000000..6342420
--- /dev/null
+++ b/src/utility.h
@@ -0,0 +1,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_