1414
1515#include " sst/core/sst_types.h"
1616
17+ #include < algorithm>
1718#include < cstring>
1819#include < functional>
1920#include < list>
@@ -88,7 +89,7 @@ namespace ELI {
8889
8990// Function used to combine the parent and child ELI information.
9091// This function only works for items that have a 'name' and a
91- // 'description' field (which is all of them at time of function
92+ // 'description/value ' field (which is all of them at time of function
9293// writing). You can delete a parent's info by adding an entry in the
9394// child with the same name and a nullptr in the description. Each
9495// info item should include a macro of the format SST_ELI_DELETE_* to
@@ -98,34 +99,29 @@ namespace ELI {
9899// the ElementInfo* classes have const data members so deleting from
99100// the vector does not compile (copy constructor is deleted).
100101template <typename T>
101- static void
102- combineEliInfo (std::vector<T>& base, std::vector<T>& add)
102+ void
103+ combineEliInfo (std::vector<T>& base, const std::vector<T>& add)
103104{
104105 std::vector<T> combined;
105106 // Add in any item that isn't already defined
106- for ( auto x : add ) {
107- bool add = true ;
108- for ( auto y : base ) {
109- if ( !strcmp (x.name , y.name ) ) {
110- add = false ;
111- break ;
112- }
113- }
114- if ( add ) combined.emplace_back (x);
107+ for ( auto & x : add ) {
108+ if ( std::none_of (base.begin (), base.end (), [&](auto & y) { return !strcmp (x.name , y.name ); }) )
109+ combined.emplace_back (x);
115110 }
116111
117112 // Now add all the locals. We will skip any one that has nullptr
118113 // in the description field
119- for ( auto x : base ) {
120- if ( x.description != nullptr ) { combined.emplace_back (x); }
114+ for ( auto & x : base ) {
115+ if constexpr ( std::is_same_v<T, ElementInfoAttribute> ) {
116+ if ( x.value != nullptr ) combined.emplace_back (x);
117+ }
118+ else {
119+ if ( x.description != nullptr ) combined.emplace_back (x);
120+ }
121121 }
122122 base.swap (combined);
123123}
124124
125- // ELI combine function for Attributes which don't have a description
126- // field
127- void combineEliInfo (std::vector<ElementInfoAttribute>& base, std::vector<ElementInfoAttribute>& add);
128-
129125struct LibraryLoader
130126{
131127 virtual void load () = 0;
0 commit comments