https://github.com/pratikpc/cpp-template-detect-if-object-contains-a-function-definition
A simple library which will help write code which can at compile time detect if a function with a specific typing is present or not
https://github.com/pratikpc/cpp-template-detect-if-object-contains-a-function-definition
Last synced: about 1 year ago
JSON representation
A simple library which will help write code which can at compile time detect if a function with a specific typing is present or not
- Host: GitHub
- URL: https://github.com/pratikpc/cpp-template-detect-if-object-contains-a-function-definition
- Owner: pratikpc
- License: mit
- Created: 2023-09-19T16:36:45.000Z (almost 3 years ago)
- Default Branch: develop
- Last Pushed: 2023-09-19T21:55:25.000Z (almost 3 years ago)
- Last Synced: 2025-04-05T21:17:02.279Z (over 1 year ago)
- Language: C++
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Code Required
```cpp
auto const contains_test = requires(T t)
{
{ t.Test(1, 2) } -> std::same_as;
};
```
# In C++17
```cpp
static constexpr auto const contains_test = static_cast(boost::hana::is_valid(
[](auto &&obj) -> decltype(obj.Test(1, 2)) {
})(t));
```