8000 GitHub - p-ranav/any_of_trait: Type traits for any_of and any_but
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

p-ranav/any_of_trait

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

any_of

Type traits for any_of<T, Args...> and any_but<T, Args...>

#include <iostream>
#include "any_of.h"

template <typename T> 
typename std::enable_if_t<any_of<T, size_t, int, float, double>::value, void>
print_number(T value) {
  std::cout << value << "\n";
}

int main() {
  std::cout << std::boolalpha;
  std::cout << any_of<int, int, float>::value << "\n";    // true
  std::cout << any_of<int, char, double>::value << "\n";  // false

  std::cout << any_but<char, std::string, int, float>::value << "\n"; // true

  print_number(5);   // OK
  // print_number('c'); // error: no matching function for call to 'print_number'
}

About

Type traits for any_of and any_but

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0