]>
Commit | Line | Data |
---|---|---|
1 | /*! | |
2 | @file | |
3 | Forward declares `boost::hana::default_` and `boost::hana::is_default`. | |
4 | ||
5 | @copyright Louis Dionne 2013-2016 | |
6 | Distributed under the Boost Software License, Version 1.0. | |
7 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) | |
8 | */ | |
9 | ||
10 | #ifndef BOOST_HANA_FWD_CORE_DEFAULT_HPP | |
11 | #define BOOST_HANA_FWD_CORE_DEFAULT_HPP | |
12 | ||
13 | #include <boost/hana/config.hpp> | |
14 | ||
15 | ||
16 | BOOST_HANA_NAMESPACE_BEGIN | |
17 | //! @ingroup group-core | |
18 | //! Mark a tag-dispatched method implementation as a default implementation. | |
19 | //! | |
20 | //! When defining a new concept with tag-dispatched methods, it is | |
21 | //! sometimes possible to provide a default implementation for some | |
22 | //! method(s). Making `default_` a base class of such a default | |
23 | //! implementation makes it possible to detect whether the method | |
24 | //! was dispatched to the default implementation afterwards. | |
25 | //! | |
26 | //! | |
27 | //! Example | |
28 | //! ------- | |
29 | //! @include example/core/default.cpp | |
30 | struct default_ { }; | |
31 | ||
32 | //! @ingroup group-core | |
33 | //! Returns whether a tag-dispatched method implementation is a default | |
34 | //! implementation. | |
35 | //! | |
36 | //! Given a tag-dispatched method implementation `method_impl<T...>`, | |
37 | //! `is_default<method_impl<T...>>` returns whether `method_impl<T...>` | |
38 | //! is a default implementation. Note that if there is no default | |
39 | //! implementation for the method, then `is_default` should not be | |
40 | //! used unless a static assertion saying that "the method is not | |
41 | //! implemented" is acceptable. | |
42 | //! | |
43 | //! | |
44 | //! Example | |
45 | //! ------- | |
46 | //! @include example/core/default.cpp | |
47 | #ifdef BOOST_HANA_DOXYGEN_INVOKED | |
48 | template <typename Method> | |
49 | struct is_default { see documentation }; | |
50 | #else | |
51 | template <typename T, typename = void> | |
52 | struct is_default; | |
53 | #endif | |
54 | BOOST_HANA_NAMESPACE_END | |
55 | ||
56 | #endif // !BOOST_HANA_FWD_CORE_DEFAULT_HPP |