enable_if

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <algorithm> using namespace std; template<typename T> typename std::enable_if<std::is_same<T, double>{} || std::is_same<T, float>{}, void>::type mysort(T arr[], int n){ std::sort(arr, arr+n); } int main() { cout << "Hello World!"; double arr[6]={1.1, 4.5, 1.4, 8.1, 0.8, 9.3}; float arrf[6]={1.1f, 4.5f, 1.4f, 8.1f, 0.8f, 9.3f}; int arri[6]={1,1,4,5,1,4}; mysort(arr, 6); mysort(arrf, 6); mysort(arri, 6); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines