Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <type_traits>
7 :
8 : #include "Utilities/Gsl.hpp"
9 : #include "Utilities/TMPL.hpp"
10 : #include "Utilities/TypeTraits/IsA.hpp"
11 :
12 0 : namespace protocols {
13 : /// Protocol for a struct with a static `apply` function returning and
14 : /// taking arguments based on tags in `return_tags` and
15 : /// `argument_tags` type aliases.
16 : ///
17 : /// \snippet Test_StaticReturnApplyable.cpp StaticReturnApplyable
18 1 : struct StaticReturnApplyable {
19 : template <typename ConformingType>
20 0 : struct test {
21 0 : using argument_tags = typename ConformingType::argument_tags;
22 0 : using return_tags = typename ConformingType::return_tags;
23 : static_assert(tt::is_a_v<tmpl::list, argument_tags>);
24 : static_assert(tt::is_a_v<tmpl::list, return_tags>);
25 :
26 : static_assert(
27 : std::is_same_v<return_tags, tmpl::remove_duplicates<return_tags>>,
28 : "return_tags should not contain duplicates.");
29 : // Duplicates in argument_tags are OK.
30 : };
31 : };
32 :
33 : } // namespace protocols
|