Created
May 18, 2018 21:00
-
-
Save iFrag/f562235a584a1abcb61fb37484b7da9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { | |
public: | |
int add(const A &value) { | |
return 0; | |
} | |
}; | |
class B { | |
public: | |
int pridaj(const B &value) { | |
return 0; | |
} | |
}; | |
template <typename T> | |
concept bool Addable = requires(T a) { | |
{a.add(a)} -> int | |
} || requires(T a) { | |
{a.pridaj(a)} -> int | |
}; | |
int add(Addable a, Addable b) { | |
return a.pridaj(b); | |
} | |
int main() { | |
f(2, 2); | |
B a, b; | |
add(a, b); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment