diff options
author | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-07-28 14:40:27 +0200 |
---|---|---|
committer | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-08-08 17:24:00 +0200 |
commit | 626b0fc7a92da537f4914afcd3ff390f855785c4 (patch) | |
tree | d3790796c80d01c857b2e1e038c82416bf9c51be /src/layers.cpp | |
parent | 979f3c80a66129cadc9260fc52eb5eab2fb73622 (diff) |
layers: provide a layers-only vector
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
Diffstat (limited to 'src/layers.cpp')
-rw-r--r-- | src/layers.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/layers.cpp b/src/layers.cpp index f475556..0d01080 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -30,10 +30,16 @@ struct result<struct surface_id_to_layer_map> to_surface_id_to_layer_map( try { surface_id_to_layer_map stl{}; auto m = j["mappings"]; + stl.layers.reserve(m.size()); std::transform( std::cbegin(m), std::cend(m), std::inserter(stl.mapping, stl.mapping.end()), - [](nlohmann::json const &j) { return surface_id_to_layer(j); }); + [&stl](nlohmann::json const &j) { + auto k = surface_id_to_layer(j); + stl.layers.push_back(unsigned(k.layer_id)); + return k; + }); + // XXX need to sort layers? for (auto i : stl.mapping) { if (i.name.empty()) { return Err<struct surface_id_to_layer_map>( |