Skip to content
Snippets Groups Projects
Commit 37be14ea authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Use alias

parent 8771e1e8
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,8 @@
namespace simox
{
nlohmann::json::const_reference json::at_any_key(const nlohmann::json& j, const std::vector<std::string>& keys)
json::json::const_reference
json::at_any_key(const json& j, const std::vector<std::string>& keys)
{
for (const std::string& key : keys)
{
......
......@@ -2,7 +2,7 @@
#include <optional>
#include "json.hpp"
#include "json.h"
namespace simox::json
......@@ -10,16 +10,18 @@ namespace simox::json
/**
* @brief Get the value at the first key in `keys` contained in `j`.
*
* @param j The JSON object.
* @param keys The keys.
* @return The value at the first contained key.
*
* @throw std::out_of_range If none of the keys is found in `j`.
*/
nlohmann::json::const_reference at_any_key(const nlohmann::json& j, const std::vector<std::string>& keys);
json::const_reference at_any_key(const json& j, const std::vector<std::string>& keys);
template <class T>
T get_at_any_key(const nlohmann::json& j, const std::vector<std::string>& keys)
T get_at_any_key(const json& j, const std::vector<std::string>& keys)
{
return at_any_key(j, keys).get<T>();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment