Skip to content

Commit c6ba211

Browse files
author
devsh
committed
improve the function template constraints a lot
1 parent 86e9a66 commit c6ba211

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

include/nbl/builtin/hlsl/concepts.hlsl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@
3434
// put just before closing `>` on the partial template specialization Type args, e.g. `MyStruct<U,V,T NBL_PARTIAL_REQ_BOT(SomeCond<U>)>
3535
#define NBL_PARTIAL_REQ_BOT(...)
3636

37-
// condition
38-
#define NBL_FUNC_REQUIRES_BEGIN(...) requires (__VA_ARGS__)
39-
// return value
40-
#define NBL_FUNC_REQUIRES_END(...) __VA_ARGS__
37+
// condition, use instead of the closing `>` of a function template
38+
#define NBL_FUNC_REQUIRES(...) > requires (__VA_ARGS__)
4139

4240
#include <concepts>
4341

@@ -120,10 +118,8 @@ concept matricial = is_matrix<T>::value;
120118
// put just before closing `>` on the partial template specialization Type args, e.g. `MyStruct<U,V,T NBL_PARTIAL_REQ_BOT(SomeCond<U>)>
121119
#define NBL_PARTIAL_REQ_BOT(...) ,std::enable_if_t<(__VA_ARGS__),void>
122120

123-
// condition, use right after the closing `>` of a function template
124-
#define NBL_FUNC_REQUIRES_BEGIN(...) ::nbl::hlsl::enable_if_t<(__VA_ARGS__),
125-
// return value, use `END(T)` instead of the return value type declaration
126-
#define NBL_FUNC_REQUIRES_END(...) __VA_ARGS__>
121+
// condition, use instead of the closing `>` of a function template
122+
#define NBL_FUNC_REQUIRES(...) ,std::enable_if_t<(__VA_ARGS__),bool> = true>
127123

128124
#endif
129125

0 commit comments

Comments
 (0)