Changeset 132:29734e7e64af in finroc_plugins_data_ports


Ignore:
Timestamp:
10.09.2018 23:16:31 (10 months ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Phase:
public
Message:

Fixes 'changed' methods in tPortPack (erroneous use of std::initializer_list)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tPortPack.h

    r126 r132  
    174174  inline bool HasChanged(size_t index) 
    175175  { 
    176     std::vector<bool> changed_flags = this->GetChangedFlags(tIndex()); // TODO: std::vector<bool> may be replaced by auto in c++14 and gcc < 4.9 to avoid heap allocation 
    177     return changed_flags[index]; 
     176    return this->GetChangedFlags(tIndex())[index]; 
    178177  } 
    179178 
     
    184183  inline bool Changed() 
    185184  { 
    186     std::vector<bool> changed_flags = this->GetChangedFlags(tIndex()); // TODO: std::vector<bool> may be replaced by auto in c++14 and gcc < 4.9 to avoid heap allocation 
     185    auto changed_flags = this->GetChangedFlags(tIndex()); 
    187186    return std::any_of(changed_flags.begin(), changed_flags.end(), [](bool x) 
    188187    { 
     
    267266 
    268267  template <int ... Tindex> 
    269   inline std::initializer_list<bool> GetChangedFlags(rrlib::util::tIntegerSequence<Tindex...>) 
    270   { 
    271     return { std::get<Tindex>(this->ports)->HasChanged()..., false }; 
     268  inline std::array<bool, sizeof...(Tindex)> GetChangedFlags(rrlib::util::tIntegerSequence<Tindex...>) 
     269  { 
     270    return { std::get<Tindex>(this->ports)->HasChanged()... }; 
    272271  } 
    273272 
Note: See TracChangeset for help on using the changeset viewer.