online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <memory> class NamedBuffer { public: NamedBuffer(char const *n, uint32_t s) : name(n) , size(s) , buffer(new uint8_t[size]) { this->info(); } // move ctor NamedBuffer(NamedBuffer && other) noexcept : name(std::move(other.name)) , size(other.size) , buffer(other.buffer) { other.size = 0; other.buffer = nullptr; this->info(); } NamedBuffer & operator=(NamedBuffer && other) noexcept { // ... return *this; } ~NamedBuffer() { delete [] buffer; buffer = nullptr; } void info() { std::cout << "name : " << this->name << '\n'; std::cout << "size : " << this->size << '\n'; std::cout << "buffer : " << static_cast<void *>(this->buffer) << '\n'; std::cout << '\n'; } // ... private: std::string name; uint32_t size; uint8_t *buffer; // raw pointer // ... }; int main() { constexpr char const *name = "TestBuffer"; constexpr uint32_t size = 1024; NamedBuffer nb1(name, size); NamedBuffer nb2 = std::move(nb1); nb1.info(); }

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