From bfe9d5aff210bc1d14cfb94c2cfbb7e2cef7fc8b Mon Sep 17 00:00:00 2001 From: q66 Date: Sun, 13 Dec 2015 21:10:18 +0000 Subject: [PATCH] switch to c++14 and make use of generalized lambda capture --- Makefile | 2 +- main.cc | 4 +--- obuild.cfg | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index eefbd1b..9781310 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ OCTASTD_PATH = ../octastd FILES = main.o globs.o cubescript.o -OB_CXXFLAGS += -std=c++11 -I. -I$(CUBESCRIPT_PATH) -I$(OCTASTD_PATH) -pthread +OB_CXXFLAGS += -std=c++14 -I. -I$(CUBESCRIPT_PATH) -I$(OCTASTD_PATH) -pthread all: obuild diff --git a/main.cc b/main.cc index c8f820e..c04cfb1 100644 --- a/main.cc +++ b/main.cc @@ -573,9 +573,7 @@ int main(int argc, char **argv) { os.add_command("shell", "C", [](ObState &os, ConstCharRange s) { auto cnt = os.counters.back(); cnt->incr(); - String ds = s; - /* in c++14 we can use generalized lambda captures to move the str */ - tpool.push([cnt, ds]() { + tpool.push([cnt, ds = String(s)]() { int ret = system(ds.data()); if (ret && !cnt->result) cnt->result = ret; diff --git a/obuild.cfg b/obuild.cfg index 7abe944..e92d926 100644 --- a/obuild.cfg +++ b/obuild.cfg @@ -7,7 +7,7 @@ OS_PATH = "../octastd" FILES = [main_ob.o globs_ob.o cubescript_ob.o] -OB_CXXFLAGS = [@OB_CXXFLAGS -std=c++11 -I. -I@CS_PATH -I@OS_PATH -pthread] +OB_CXXFLAGS = [@OB_CXXFLAGS -std=c++14 -I. -I@CS_PATH -I@OS_PATH -pthread] rule obuild $FILES [ echo " LD" $target