osrm-backend/extractor
Daniel J. Hofmann 94af9b7f13 Caches iterators instead of invoking function calls on every iteration.
This caches iterators, i.e. especially the end iterator when possible.

The problem:

    for (auto it = begin(seq); it != end(seq); ++it)

this has to call `end(seq)` on every iteration, since the compiler is
not able to reason about the call's site effects (to bad, huh).

Instead do it like this:

    for (auto it = begin(seq), end = end(seq); it != end; ++it)

caching the end iterator.

Of course, still better would be:

    for (auto&& each : seq)

if all you want is value semantics.

Why `auto&&` you may ask? Because it binds to everything and never copies!

Skim the referenced proposal (that was rejected, but nevertheless) for a
detailed explanation on range-based for loops and why `auto&&` is great.

Reference:

- http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3853.htm
2015-09-15 12:09:39 +02:00
..
extraction_containers.cpp Caches iterators instead of invoking function calls on every iteration. 2015-09-15 12:09:39 +02:00
extraction_containers.hpp Fix processing for data files with incorrect node references 2015-09-10 12:22:03 +02:00
extraction_helper_functions.hpp First step into overhauling the edge storage 2015-06-01 17:22:12 +02:00
extraction_node.hpp change copyright line from personal names to project 2015-02-19 09:19:51 +01:00
extraction_way.hpp Remove unused memebers and rename to currrent style convention 2015-07-01 18:07:29 +02:00
extractor_callbacks.cpp Remove unused memebers and rename to currrent style convention 2015-07-01 18:07:29 +02:00
extractor_callbacks.hpp Move string_map inside external_callbacks 2015-04-21 20:00:58 +02:00
extractor_options.cpp First step into overhauling the edge storage 2015-06-01 17:22:12 +02:00
extractor_options.hpp First step into overhauling the edge storage 2015-06-01 17:22:12 +02:00
extractor.cpp Caches iterators instead of invoking function calls on every iteration. 2015-09-15 12:09:39 +02:00
extractor.hpp Modernize the code base to C++11 standards and beyond. 2015-08-18 12:56:34 +02:00
first_and_last_segment_of_way.hpp change copyright line from personal names to project 2015-02-19 09:19:51 +01:00
internal_extractor_edge.hpp Modernize the code base to C++11 standards and beyond. 2015-08-18 12:56:34 +02:00
lat Implement raster source feature to read data from third-party sources, to be used in lua profiles. 2015-09-03 22:28:18 -07:00
restriction_parser.cpp Parse specific restriction:* tags based on profile exceptions 2015-09-10 15:52:26 -07:00
restriction_parser.hpp Updated restriction parser doc 2015-04-21 20:00:58 +02:00
scripting_environment.cpp Implement raster source feature to read data from third-party sources, to be used in lua profiles. 2015-09-03 22:28:18 -07:00
scripting_environment.hpp Add documentation to ScriptingEnvironment 2015-04-21 20:00:58 +02:00
source_coordinate.lat Implement raster source feature to read data from third-party sources, to be used in lua profiles. 2015-09-03 22:28:18 -07:00