Skip to content
Snippets Groups Projects
Commit 548895ad authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Fix use of std::array<T,1> as properties

parent 2d1e72bf
No related branches found
No related tags found
1 merge request!1197Fix handling of properties for tuples and arrays of size 1
......@@ -239,7 +239,11 @@ namespace Gaudi {
*/
template <class TYPE, unsigned int N>
std::ostream& toStream( const TYPE ( &obj )[N], std::ostream& s ) {
return toStream( obj, obj + N, s, "( ", " )", " , " );
if constexpr ( N == 1 ) {
return toStream( obj[0], s << "( " ) << " , )";
} else {
return toStream( obj, obj + N, s, "( ", " )", " , " );
}
}
// ========================================================================
/** the specialization for std::array, a'la python tuple
......@@ -248,7 +252,11 @@ namespace Gaudi {
*/
template <class TYPE, std::size_t N>
std::ostream& toStream( const std::array<TYPE, N>& obj, std::ostream& s ) {
return toStream( begin( obj ), end( obj ), s, "( ", " )", " , " );
if constexpr ( N == 1 ) {
return toStream( obj[0], s << "( " ) << " , )";
} else {
return toStream( begin( obj ), end( obj ), s, "( ", " )", " , " );
}
}
// ========================================================================
/** the specialization for C-string, a'la python tuple
......
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