f0rmull

Untitled

Dec 3rd, 2021
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <thread>
  3. #include <string>
  4. #include <thread>
  5. #include <mutex>
  6.  
  7. template <typename ...Arg>
  8. concept is_fucking_string = (std::is_convertible_v<Arg, std::string> && ...);
  9.  
  10. template <typename T,typename...Pack>
  11. concept is_same = requires(T t,Pack...pk)
  12. {
  13.     requires(std::is_same_v<T, Pack> && ...);
  14.    
  15.  
  16. };
  17. template <typename T,typename ...Arg>
  18. concept mixin = is_fucking_string<Arg...> && is_same<T,Arg...>;
  19. template <typename T,typename ...Arg>
  20. decltype(auto) foo(T t,Arg...arg) requires mixin<T,Arg...>
  21. {
  22.     return (std::string(t) + ... + std::string(arg));
  23. }
  24. template <typename T,typename ...Arg>
  25. decltype(auto) foo(T t,Arg...arg) requires is_same<T,Arg...>
  26. {
  27.     return (arg + ...);
  28. }
  29. int main()
  30. {
  31.     std::cout << foo("33","gg");
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment