Skip to content

Commit

Permalink
return val
Browse files Browse the repository at this point in the history
  • Loading branch information
JarrettSJohnson committed May 20, 2024
1 parent 2be819c commit bfab47e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions layer2/CifFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ namespace cif_detail {
std::vector<CifArrayElement> m_arr{};
};

/**
* Returns a typed value from a CIF data element.
* If the element is missing or inapplicable, return `d`.
* @param var CIF data element
* @param d default value
* @return typed value
*/
template <typename T> T var_to_typed(const CifArrayElement& var, const T& d)
{
if constexpr (std::is_same_v<T, const char*>) {
Expand All @@ -191,6 +198,7 @@ namespace cif_detail {
var);
}
}
return d;
}
}

Expand Down

0 comments on commit bfab47e

Please sign in to comment.