online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> // std::cout #include <type_traits> // std::is_same #include <vector> template<typename Container, typename Index> // works, but auto authAndAccess(Container& c, Index i) // requires -> decltype(c[i]) // refinement { return c[i]; } template<typename Container, typename Index> auto authAndAccess14(Container& c, Index i) { return c[i]; } template<class T1, class T2> void print_is_same() { std::cout << std::boolalpha << std::is_same<T1, T2>() << '\n'; } int main() { std::vector<float> vec {1.,2.,3.,5.}; typedef decltype(authAndAccess(vec, 2.)) ReturnType; typedef decltype(authAndAccess14(vec, 2.)) ReturnType14; print_is_same<float, std::remove_reference<ReturnType>::type>(); print_is_same<float, ReturnType>(); print_is_same<float, std::remove_reference<ReturnType14>::type>(); print_is_same<float, ReturnType14>(); }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue