diff options
author | Anand Thakker <github@anandthakker.net> | 2017-08-23 09:58:49 -0400 |
---|---|---|
committer | Anand Thakker <github@anandthakker.net> | 2017-10-13 12:50:51 -0400 |
commit | 63d0d3ef2ef2a2b53fab5176fb7b9b2b49903b33 (patch) | |
tree | 6af1813f4ee0a37b896a9bb750475d20bdb1d0e0 | |
parent | 4607c664a74bc231ae666c33e57da1d5b665740d (diff) | |
download | qtlocation-mapboxgl-63d0d3ef2ef2a2b53fab5176fb7b9b2b49903b33.tar.gz |
Use std::array rather than std::vector when evaluating CompoundExpression
-rw-r--r-- | src/mbgl/style/expression/compound_expression.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mbgl/style/expression/compound_expression.cpp b/src/mbgl/style/expression/compound_expression.cpp index 6338ca6284..be301e8a78 100644 --- a/src/mbgl/style/expression/compound_expression.cpp +++ b/src/mbgl/style/expression/compound_expression.cpp @@ -49,12 +49,12 @@ struct Signature<R (const EvaluationParameters&, Params...)> : SignatureBase { private: template <std::size_t ...I> EvaluationResult applyImpl(const EvaluationParameters& evaluationParameters, const Args& args, std::index_sequence<I...>) const { - const std::vector<EvaluationResult>& evaluated = {std::get<I>(args)->evaluate(evaluationParameters)...}; + const std::array<EvaluationResult, sizeof...(I)>& evaluated = {{std::get<I>(args)->evaluate(evaluationParameters)...}}; for (const auto& arg : evaluated) { if(!arg) return arg.error(); } // TODO: assert correct runtime type of each arg value - const R& value = evaluate(evaluationParameters, get<Params>(*(evaluated.at(I)))...); + const R& value = evaluate(evaluationParameters, get<Params>(*(evaluated[I]))...); if (!value) return value.error(); return *value; } @@ -126,12 +126,12 @@ struct Signature<R (Params...)> : SignatureBase { private: template <std::size_t ...I> EvaluationResult applyImpl(const EvaluationParameters& evaluationParameters, const Args& args, std::index_sequence<I...>) const { - const std::vector<EvaluationResult>& evaluated = {std::get<I>(args)->evaluate(evaluationParameters)...}; + const std::array<EvaluationResult, sizeof...(I)>& evaluated = {{std::get<I>(args)->evaluate(evaluationParameters)...}}; for (const auto& arg : evaluated) { if(!arg) return arg.error(); } // TODO: assert correct runtime type of each arg value - const R& value = evaluate(get<Params>(*(evaluated.at(I)))...); + const R& value = evaluate(get<Params>(*(evaluated[I]))...); if (!value) return value.error(); return *value; } |