From 1ac2664472d0135503e54f0d924a802023855003 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 21 Feb 2022 16:32:34 +0100 Subject: [PATCH] Remove std::vector alias --- src/build-remote/build-remote.cc | 2 +- src/libexpr/nixexpr.hh | 4 ++-- src/libexpr/parser.y | 16 ++++++++-------- src/libexpr/primops.cc | 4 ++-- src/libutil/config.cc | 4 ++-- src/libutil/types.hh | 3 +-- src/libutil/util.cc | 2 +- src/libutil/util.hh | 2 +- src/nix-env/nix-env.cc | 6 +++--- 9 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/build-remote/build-remote.cc b/src/build-remote/build-remote.cc index 9d541b45d..4d7b602d8 100644 --- a/src/build-remote/build-remote.cc +++ b/src/build-remote/build-remote.cc @@ -208,7 +208,7 @@ static int main_build_remote(int argc, char * * argv) for (auto & m : machines) error - % concatStringsSep>(", ", m.systemTypes) + % concatStringsSep>(", ", m.systemTypes) % m.maxJobs % concatStringsSep(", ", m.supportedFeatures) % concatStringsSep(", ", m.mandatoryFeatures); diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index 6f6acb074..e7f717eba 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -335,8 +335,8 @@ struct ExprConcatStrings : Expr { Pos pos; bool forceString; - vector > * es; - ExprConcatStrings(const Pos & pos, bool forceString, vector > * es) + std::vector > * es; + ExprConcatStrings(const Pos & pos, bool forceString, std::vector > * es) : pos(pos), forceString(forceString), es(es) { }; COMMON_METHODS }; diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index f0c80ebd5..e1d177c1f 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -193,7 +193,7 @@ static Formals * toFormals(ParseData & data, ParserFormals * formals, static Expr * stripIndentation(const Pos & pos, SymbolTable & symbols, - vector > > & es) + std::vector > > & es) { if (es.empty()) return new ExprString(""); @@ -233,7 +233,7 @@ static Expr * stripIndentation(const Pos & pos, SymbolTable & symbols, } /* Strip spaces from each line. */ - vector > * es2 = new vector >; + std::vector > * es2 = new std::vector >; atStartOfLine = true; size_t curDropped = 0; size_t n = es.size(); @@ -415,7 +415,7 @@ expr_op | expr_op UPDATE expr_op { $$ = new ExprOpUpdate(CUR_POS, $1, $3); } | expr_op '?' attrpath { $$ = new ExprOpHasAttr($1, *$3); } | expr_op '+' expr_op - { $$ = new ExprConcatStrings(CUR_POS, false, new vector >({{makeCurPos(@1, data), $1}, {makeCurPos(@3, data), $3}})); } + { $$ = new ExprConcatStrings(CUR_POS, false, new std::vector >({{makeCurPos(@1, data), $1}, {makeCurPos(@3, data), $3}})); } | expr_op '-' expr_op { $$ = new ExprCall(CUR_POS, new ExprVar(data->symbols.create("__sub")), {$1, $3}); } | expr_op '*' expr_op { $$ = new ExprCall(CUR_POS, new ExprVar(data->symbols.create("__mul")), {$1, $3}); } | expr_op '/' expr_op { $$ = new ExprCall(CUR_POS, new ExprVar(data->symbols.create("__div")), {$1, $3}); } @@ -503,9 +503,9 @@ string_parts_interpolated : string_parts_interpolated STR { $$ = $1; $1->emplace_back(makeCurPos(@2, data), new ExprString(string($2))); } | string_parts_interpolated DOLLAR_CURLY expr '}' { $$ = $1; $1->emplace_back(makeCurPos(@2, data), $3); } - | DOLLAR_CURLY expr '}' { $$ = new vector >; $$->emplace_back(makeCurPos(@1, data), $2); } + | DOLLAR_CURLY expr '}' { $$ = new std::vector >; $$->emplace_back(makeCurPos(@1, data), $2); } | STR DOLLAR_CURLY expr '}' { - $$ = new vector >; + $$ = new std::vector >; $$->emplace_back(makeCurPos(@1, data), new ExprString(string($1))); $$->emplace_back(makeCurPos(@2, data), $3); } @@ -528,7 +528,7 @@ path_start ind_string_parts : ind_string_parts IND_STR { $$ = $1; $1->emplace_back(makeCurPos(@2, data), $2); } | ind_string_parts DOLLAR_CURLY expr '}' { $$ = $1; $1->emplace_back(makeCurPos(@2, data), $3); } - | { $$ = new vector > >; } + | { $$ = new std::vector > >; } ; binds @@ -582,9 +582,9 @@ attrpath } else $$->push_back(AttrName($3)); } - | attr { $$ = new vector; $$->push_back(AttrName(data->symbols.create($1))); } + | attr { $$ = new std::vector; $$->push_back(AttrName(data->symbols.create($1))); } | string_attr - { $$ = new vector; + { $$ = new std::vector; ExprString *str = dynamic_cast($1); if (str) { $$->push_back(AttrName(data->symbols.create(str->s))); diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 44f0b19bc..daf679a5a 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -3649,12 +3649,12 @@ static void prim_replaceStrings(EvalState & state, const Pos & pos, Value * * ar .errPos = pos }); - vector from; + std::vector from; from.reserve(args[0]->listSize()); for (auto elem : args[0]->listItems()) from.emplace_back(state.forceString(*elem, pos)); - vector> to; + std::vector> to; to.reserve(args[1]->listSize()); for (auto elem : args[1]->listItems()) { PathSet ctx; diff --git a/src/libutil/config.cc b/src/libutil/config.cc index 92ab265d3..8e05f1765 100644 --- a/src/libutil/config.cc +++ b/src/libutil/config.cc @@ -90,7 +90,7 @@ void AbstractConfig::applyConfig(const std::string & contents, const std::string if (hash != string::npos) line = string(line, 0, hash); - vector tokens = tokenizeString >(line); + auto tokens = tokenizeString>(line); if (tokens.empty()) continue; if (tokens.size() < 2) @@ -122,7 +122,7 @@ void AbstractConfig::applyConfig(const std::string & contents, const std::string string name = tokens[0]; - vector::iterator i = tokens.begin(); + auto i = tokens.begin(); advance(i, 2); set(name, concatStringsSep(" ", Strings(i, tokens.end()))); // FIXME: slow diff --git a/src/libutil/types.hh b/src/libutil/types.hh index 057c9021c..a26c9a966 100644 --- a/src/libutil/types.hh +++ b/src/libutil/types.hh @@ -11,7 +11,6 @@ namespace nix { -using std::vector; using std::string; typedef std::list Strings; @@ -25,7 +24,7 @@ typedef std::string_view PathView; typedef std::list Paths; typedef std::set PathSet; -typedef vector> Headers; +typedef std::vector> Headers; /* Helper class to run code at startup. */ template diff --git a/src/libutil/util.cc b/src/libutil/util.cc index b6041264e..b172e0554 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -1250,7 +1250,7 @@ template C tokenizeString(std::string_view s, std::string_view separato template Strings tokenizeString(std::string_view s, std::string_view separators); template StringSet tokenizeString(std::string_view s, std::string_view separators); -template vector tokenizeString(std::string_view s, std::string_view separators); +template std::vector tokenizeString(std::string_view s, std::string_view separators); string chomp(std::string_view s) diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 319442210..a949e6424 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -99,7 +99,7 @@ struct DirEntry : name(name), ino(ino), type(type) { } }; -typedef vector DirEntries; +typedef std::vector DirEntries; DirEntries readDirectory(const Path & path); diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index d2636abf7..52d07e3df 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -840,7 +840,7 @@ void printTable(Table & table) { auto nrColumns = table.size() > 0 ? table.front().size() : 0; - vector widths; + std::vector widths; widths.resize(nrColumns); for (auto & i : table) { @@ -907,7 +907,7 @@ static VersionDiff compareVersionAgainstSet( } -static void queryJSON(Globals & globals, vector & elems, bool printOutPath, bool printMeta) +static void queryJSON(Globals & globals, std::vector & elems, bool printOutPath, bool printMeta) { JSONObject topObj(cout, true); for (auto & i : elems) { @@ -1020,7 +1020,7 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs) /* Sort them by name. */ /* !!! */ - vector elems; + std::vector elems; for (auto & i : elems_) elems.push_back(i); sort(elems.begin(), elems.end(), cmpElemByName);