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 <iostream> #include <vector> #include <array> #include <cstdint> #include <limits> #include <algorithm> #include <limits> #include <optional> std::array<std::optional<std::uint32_t>, 5> elem_arr; void copy_from_vector(std::vector<std::uint32_t> elem_vec) { std::transform( elem_vec.begin() , elem_vec.end() , elem_arr.begin() , []( auto val ) { return std::optional<std::uint32_t>{ val }; } ); } std::vector<std::uint32_t> copy_from_array() { std::vector<std::uint32_t> ele_vec_copy; std::vector<std::optional<std::uint32_t>> non_null_elements; std::copy_if( elem_arr.begin() , elem_arr.end() , std::back_inserter( non_null_elements ) , []( auto val ) { return val; } ); std::transform( non_null_elements.begin(), non_null_elements.end() , std::back_inserter( ele_vec_copy ) , []( auto val ) { return *val; } ); return ele_vec_copy; } int main() { std::vector<std::uint32_t> ele_vec {1,2,3}; copy_from_vector(ele_vec); auto ele_vec_copy = copy_from_array(); for(auto ele : ele_vec_copy) std::cout << ele << 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