switch to c++14 and make use of generalized lambda capture

master
Daniel Kolesa 2015-12-13 21:10:18 +00:00
parent 9ffcec83c8
commit bfe9d5aff2
3 changed files with 3 additions and 5 deletions

View File

@ -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

View File

@ -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;

View File

@ -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