osh.h

My personal stdc++ replacement
git clone git://git.oshgnacknak.de/osh.h.git
Log | Files | Refs | README

commit 32a1ce441b1a2e8874c7c3b9d3042fc79a35feb4
parent eeaf9ca53bcb4f7fe7a3217dfe66f67f0ec894a2
Author: Oshgnacknak <osh@oshgnacknak.de>
Date:   Sun, 23 Jan 2022 18:56:42 +0100

Fix auto_destruct.cpp example

Passing a AutoDestruct instance down the call stack destroy it.

Diffstat:
MMakefile | 2+-
Mexamples/auto_destruct.cpp | 4+++-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,4 +1,4 @@ -CXXFLAGS := -std=c++20 -fno-exceptions -I. +CXXFLAGS := -ggdb -std=c++20 -fno-exceptions -I. EXAMPLES := $(subst .cpp,,$(wildcard examples/*.cpp)) diff --git a/examples/auto_destruct.cpp b/examples/auto_destruct.cpp @@ -18,7 +18,9 @@ struct V1 { int main() { { - AutoDestruct<StringBuffer> a = "Hallo"; + StringBuffer a = "Hello"; + auto destroyA = autoDestruct(a); + println("AutoDestruct created: ", a); StringBuffer b = a;