/*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2016-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
struct initlist_construct_t {};
constexpr initlist_construct_t initlist_construct{};
+/**
+ * A generic tag type to indicate that some constructor or method is in some way
+ * unsafe and should be used only with extreme care and with full test coverage,
+ * if ever.
+ *
+ * Example:
+ *
+ * void takes_numbers(std::vector<int> alist) {
+ * std::sort(alist.begin(), alist.end());
+ * takes_numbers_assume_sorted(folly::unsafe, alist);
+ * }
+ *
+ * void takes_numbers_assume_sorted(folly::unsafe_t, std::vector<int> alist) {
+ * assert(std::is_sorted(alist.begin(), alist.end())); // debug mode only
+ * for (i : alist) {
+ * // some behavior which is defined and safe only when alist is sorted ...
+ * }
+ * }
+ */
+struct unsafe_t {};
+constexpr unsafe_t unsafe{};
+
/**
* A simple function object that passes its argument through unchanged.
*
} // namespace moveonly_
using MoveOnly = moveonly_::MoveOnly;
+
+/**
+ * A pithy alias for std::integral_constant<bool, B>.
+ */
+template <bool B>
+using Bool = std::integral_constant<bool, B>;
+
} // namespace folly