Squashed 'third_party/boostorg/type_traits/' content from commit 059ed88
Change-Id: I222c604dfa1db194bf53bc6aa1152fb16e83ce06
git-subtree-dir: third_party/boostorg/type_traits
git-subtree-split: 059ed8839da3fecd1e8b62cdc11be006f6346b5e
diff --git a/doc/is_detected.qbk b/doc/is_detected.qbk
new file mode 100644
index 0000000..b788af5
--- /dev/null
+++ b/doc/is_detected.qbk
@@ -0,0 +1,47 @@
+[/
+Copyright 2018 Glen Joseph Fernandes
+<glenjofe -at- gmail.com>
+
+Distributed under the Boost Software License,
+Version 1.0. (See accompanying file LICENSE_1_0.txt
+or copy at http://www.boost.org/LICENSE_1_0.txt).
+]
+
+[section:is_detected is_detected]
+
+ template<template<class...> class Op, class... Args>
+ using is_detected = __below;
+
+ template<template<class...> class Op, class... Args>
+ constexpr bool is_detected_v = is_detected<Op, Args...>::value;
+
+__alias If `Op<Args...>` is a valid template-id, aliases __true_type,
+otherwise aliases __false_type.
+
+__std_paper [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4502.pdf N4502]
+
+__compat Requires C++11 variadic templates and C++11 template aliases.
+
+__header `#include <boost/type_traits/is_detected.hpp>`
+
+__examples
+
+Suppose we wish to "reset" a value of type T, if the type has a `clear()` member function then we should call
+it, otherwise we should assign a default constructed value:
+
+ template<class T>
+ using clear_t = decltype(boost::declval<T&>().clear());
+
+ template<class T>
+ void clear(T& value)
+ {
+ if constexpr (boost::is_detected_v<clear_t, T>) {
+ value.clear();
+ } else {
+ value = T();
+ }
+ }
+
+See also: __is_detected_convertible, __is_detected_exact.
+
+[endsect]