@@ -649,6 +649,39 @@ struct _cali_configset_t {
649649 std::map<std::string, std::string> cfgset;
650650};
651651
652+
653+ /* *
654+ *
655+ * When the BG/Q machines die at LLNL, we can delete these.
656+ * They exist because BG/Q had Clang compilers that *mostly*
657+ * supported C++11, except for features like std::vector<T>::emplace.
658+ */
659+
660+ template <typename Container, typename = void >
661+ struct emplace_helper {
662+ template <typename Emplaced>
663+ static void emplace (Container& emplace_into, Emplaced object){
664+ emplace_into.insert (object);
665+ }
666+ };
667+
668+ template <typename Container>
669+ struct emplace_helper <
670+ Container,
671+ typename std::enable_if<
672+ std::is_same<
673+ decltype (std::declval<Container>().emplace(std::make_pair(" " ," " ))),
674+ decltype(std::declval<Container>().emplace(std::make_pair(" " ," " )))
675+ >::value
676+ , void
677+ >::type
678+ > {
679+ template <typename Emplaced>
680+ static void emplace (Container& emplace_into, Emplaced&& object){
681+ emplace_into.emplace (object);
682+ }
683+ };
684+
652685cali_configset_t
653686cali_create_configset (const char * keyvallist[][2 ])
654687{
@@ -657,9 +690,10 @@ cali_create_configset(const char* keyvallist[][2])
657690 if (!keyvallist)
658691 return cfg;
659692
660- for ( ; (*keyvallist)[0 ] && (*keyvallist)[1 ]; ++keyvallist)
661- cfg->cfgset . emplace ( std::make_pair (std::string ((*keyvallist)[0 ]),
693+ for ( ; (*keyvallist)[0 ] && (*keyvallist)[1 ]; ++keyvallist){
694+ emplace_helper< decltype ( cfg->cfgset )>:: emplace ( cfg-> cfgset , std::make_pair (std::string ((*keyvallist)[0 ]),
662695 std::string ((*keyvallist)[1 ])) );
696+ }
663697
664698 return cfg;
665699}
0 commit comments