Created
July 30, 2018 16:20
-
-
Save loliGothicK/fcffa1ab13e60f11196a4e2713609284 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <tuple> | |
using namespace std; | |
int | |
main(){ | |
vector< pair< std::string, int, int > > vec; | |
// 超ダサいし、読みにくいし、パフォーマンスも悪そうなコード | |
vec.push_back( make_tuple( "hoge", 1, 0 ) ); | |
// コンストラクタに直接初期化子を完全転送して要素を構築 | |
// 若干イケてるし、読みやすいし、パフォーマンスも良さそう | |
vec.emplace_back( "hoge", 1, 0 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment