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

Merge branch 'refactor-tostream-array' into 'master'

Add toStream specialization for std::array into ToStream.h

See merge request !334
parents 49c12028 959713d3
No related branches found
No related tags found
1 merge request!334Add toStream specialization for std::array into ToStream.h
Pipeline #
......@@ -7,6 +7,7 @@
// ============================================================================
#include <algorithm>
#include <array>
#include "GaudiKernel/ToStream.h"
// ============================================================================
/** @file
* Collection of utilities, which allows to use class std::array
......@@ -37,22 +38,6 @@ namespace Gaudi
const std::string& close , // closing
const std::string& delim ) ; // delimiter
// ========================================================================
/** printout of class std::array
* The format is "Python's tuple"
* @param obj (INPUT) the arary to be printed
* @param s (UPDATE) the actual stream
* @return the updated stream
* @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
* @date 2009-09-16
*/
template <class TYPE, std::size_t N>
inline std::ostream& toStream
( const std::array<TYPE,N>& obj , std::ostream& s )
{
return toStream
( obj.begin () , obj.end () , s , " ( " , " )" , " , " ) ;
}
// ========================================================================
} // end of namespace Gaudi::Utils
// ==========================================================================
} // end of namespace Gaudi
......
......@@ -8,6 +8,7 @@
// ============================================================================
#include <iostream>
#include <iomanip>
#include <array>
#include <vector>
#include <map>
#include <set>
......@@ -252,19 +253,19 @@ namespace Gaudi
* @date 2009-10-05
*/
template <class TYPE, unsigned int N>
std::ostream& toStream ( TYPE(&obj)[N] , std::ostream& s )
std::ostream& toStream ( const TYPE(&obj)[N] , std::ostream& s )
{
return toStream ( obj , obj + N , s , "( " , " )" , " , " ) ;
}
// ========================================================================
/** the specialization for C-arrays, a'la python tuple
/** the specialization for std::array, a'la python tuple
* @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
* @date 2009-10-05
* @date 2009-09-16
*/
template <class TYPE, unsigned int N>
std::ostream& toStream ( const TYPE(&obj)[N] , std::ostream& s )
template <class TYPE, std::size_t N>
std::ostream& toStream ( const std::array<TYPE,N>& obj , std::ostream& s )
{
return toStream ( obj , obj + N , s , "( " , " )" , " , " ) ;
return toStream ( begin(obj) , end(obj) , s , "( " , " )" , " , " ) ;
}
// ========================================================================
/** the specialization for C-string, a'la python tuple
......@@ -272,14 +273,6 @@ namespace Gaudi
* @date 2009-10-05
*/
template <unsigned int N>
std::ostream& toStream ( char (&obj)[N] , std::ostream& s )
{ return toStream ( std::string ( obj , obj+N ) , s ) ; }
// ========================================================================
/** the specialization for C-string, a'la python tuple
* @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
* @date 2009-10-05
*/
template <unsigned int N>
std::ostream& toStream ( const char (&obj)[N] , std::ostream& s )
{ return toStream ( std::string ( obj , obj+N ) , s ) ; }
// ========================================================================
......
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