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

add constructor from std::initializer_list to GaudiUtils::VectorMap

add support to construct a GaudiUtils::VectorMap from an std::initializer_list

Fixes GAUDI-1154.

See merge request !82
parents 2d10efcc 1ea04917
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <ostream> #include <ostream>
#include <initializer_list>
// ============================================================================ // ============================================================================
// GaudiKernel // GaudiKernel
// ============================================================================ // ============================================================================
...@@ -730,6 +731,16 @@ namespace GaudiUtils ...@@ -730,6 +731,16 @@ namespace GaudiUtils
: m_vct ( first , last , alloc ) : m_vct ( first , last , alloc )
{ std::sort ( m_vct.begin(), m_vct.end(), compare() ) ; } { std::sort ( m_vct.begin(), m_vct.end(), compare() ) ; }
// ======================================================================== // ========================================================================
/** tconstructor from initializer list
* @param list
* @param cmp comparison criteria for the key
* @param alloc allocator to be used
*/
VectorMap ( std::initializer_list<value_type> first ,
const allocator_type& alloc = allocator_type () )
: m_vct ( first , alloc )
{ std::sort ( m_vct.begin(), m_vct.end(), compare() ) ; }
// ========================================================================
/// destructor (non-virtual!) /// destructor (non-virtual!)
~VectorMap() { clear() ; } // destructor (non-virtual!) ~VectorMap() { clear() ; } // destructor (non-virtual!)
// ======================================================================== // ========================================================================
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment