Commit ca18f396 authored by Damien L-G's avatar Damien L-G

Ensure that there will be no copy of the Spline returned by Map::get_spline()

parent 1d6f2be4
......@@ -7,6 +7,7 @@
#include <fstream>
#include <stdexcept>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
......@@ -78,6 +79,11 @@ void check_valid_number_of_options(std::vector<std::string> const &options,
template <typename Spline>
Spline const &Map<Spline>::get_spline(std::string const &which) {
// NOTE Decided to return a const reference (rather than a pointer to a
// const-qualified Spline). The static assertions below ensure that there
// will be no accidental copies.
auto it = _splines.find(which);
if (it == _splines.end()) {
auto const options = parse_options(which);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment