online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <functional> #include <string> #include <iostream> template<typename T> struct lambda_trait_helper; template<typename T, typename Result, typename... Args> struct lambda_trait_helper<Result(T::*)(Args...) const> { using result_type = Result; }; template<typename Func> struct lambda_traits: lambda_trait_helper<decltype(&Func::operator())> {}; template<typename... ArgTypes> class MyClass { public: //boolean function of some argument template<typename Type> using Func = bool(Type const &); //type for a tuple of pointers to templated boolean functions template<typename... Types> using TupleOfFunctions = typename std::tuple<Func<Types>*...>; //the tuple TupleOfFunctions<ArgTypes...> _tuple; //constructor MyClass(TupleOfFunctions<ArgTypes...> t) : _tuple(t) { } }; int main(int argc, char** argv) { bool (*i)(int&) = +[](int &arg){return arg > 0;}; MyClass<int, std::string> M(std::make_tuple(+[](const int &arg) { return arg > 0; },+[](const std::string &arg) { return arg == "abc"; })); std::cout << (*std::get<0>(M._tuple))(1) << std::endl; std::cout << (*std::get<1>(M._tuple))("xyz") << std::endl; return 0; }

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