Created
April 12, 2018 19:10
-
-
Save loliGothicK/39cb3f21bcac603a9ecb227c3715b36c 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
#include <limits> | |
#include <utility> | |
template < class T > | |
constexpr | |
decltype(std::declval<T>()*2) | |
twice(T a) { | |
return a*2; | |
} | |
static_assert([]{ | |
for(int i{0}; i < 1'000'000; ++i) | |
if ( twice(i) != i*2 ) return false; | |
return true; | |
}()); | |
int main() {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment