An open API service indexing awesome lists of open source software.

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

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));
```