Line data Source code
1 : // SPDX-License-Identifier: BSD-3-Clause 2 : // Copyright (c) 2023 Scipp contributors (https://github.com/scipp) 3 : /// @file 4 : /// @author Simon Heybrock 5 : #pragma once 6 : 7 : #include "scipp/dataset/dataset.h" 8 : 9 : template <class T> 10 235 : T rename_dims(T &self, const std::map<std::string, std::string> &name_dict) { 11 235 : std::vector<std::pair<Dim, Dim>> names; 12 235 : names.reserve(name_dict.size()); 13 580 : for (const auto &[from, to] : name_dict) 14 345 : names.emplace_back(Dim{from}, Dim{to}); 15 468 : return self.rename_dims(names); 16 235 : }