From 00b0edac2e315b714f6317829bbc6cbd744d44cb Mon Sep 17 00:00:00 2001 From: Florian Franzmann Date: Sun, 1 Dec 2019 17:44:20 +0100 Subject: [PATCH 05/35] Cleanup: use emplace instead of push_back --- sample.cpp | 6 +++--- tests.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sample.cpp b/sample.cpp index 82b4f5d..41ac979 100644 --- a/sample.cpp +++ b/sample.cpp @@ -39,9 +39,9 @@ void createDB() Person x; x.name=names[i%5]; x.age=14+i*0.1; - x.bio.push_back("Hello"); - x.bio.push_back("world"); - x.bio.push_back("!"); + x.bio.emplace_back("Hello"); + x.bio.emplace_back("world"); + x.bio.emplace_back("!"); hiberlite::bean_ptr p=db.copyBean(x); //create a managed copy of the object } diff --git a/tests.cpp b/tests.cpp index a7794f6..011f8e5 100644 --- a/tests.cpp +++ b/tests.cpp @@ -110,7 +110,7 @@ struct Tester{ for(unsigned int i=0;i<5;i++){ obj.mm[i%3].push_back(i); obj.mm[i%3].push_back(2*i); - obj.vi.push_back(make_pair(i,i*i*i)); + obj.vi.emplace_back(i,i*i*i); obj.seti.insert(1.0/i); string name("01234567890123123123123"); -- 2.24.0 .