Changeset 108:e4c5d0d9de8c in finroc_plugins_data_ports


Ignore:
Timestamp:
16.05.2017 00:28:23 (2 years ago)
Author:
Tobias Föhst <foehst@…>
Branch:
14.08
Children:
109:45ca8f1323a7, 111:9fa05a16eed9, 112:4756cdcbb205
Phase:
public
Rebase:
65613966383535623833363061396161616136633238306433313932623833363864663966346539
Message:

Bugfix: enables constructors with port name iterators

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tPortPack.h

    r56 r108  
    7777{ 
    7878 
     79  template <bool value, typename> 
     80  using CheckIterators = std::integral_constant<bool, value>; 
     81 
    7982//---------------------------------------------------------------------- 
    8083// Public methods and typedefs 
     
    8992  } 
    9093 
    91   template <typename TIterator> 
     94  template <typename TIterator, typename std::enable_if<CheckIterators<(Tsize> 1), TIterator>::value, int>::type = 0 > 
     95      inline tPortPack(core::tFrameworkElement *parent, TIterator names_begin, TIterator names_end) : 
     96        tPortPack < TPort, TTypeList, Tsize - 1 > (parent, names_begin, names_end - 1), 
     97        port(*(names_end - 1), parent) 
     98  { 
     99    this->port.Init(); 
     100  } 
     101 
     102  template <typename TIterator, typename std::enable_if<CheckIterators<(Tsize == 1), TIterator>::value, int>::type = 0> 
    92103  inline tPortPack(core::tFrameworkElement *parent, TIterator names_begin, TIterator names_end) : 
    93     tPortPack < TPort, TTypeList, Tsize - 1 > (parent, names_begin, names_end - 1), 
    94     port(names_end - 1, parent) 
     104    tPortPack < TPort, TTypeList, Tsize - 1 > (parent, *names_begin), 
     105    port(*names_begin, parent) 
    95106  { 
    96107    this->port.Init(); 
     
    134145  inline tPortPack(core::tFrameworkElement *parent, const std::string &name_prefix) 
    135146  {} 
     147 
     148  template <typename TIterator> 
     149  inline tPortPack(core::tFrameworkElement *parent, TIterator names_begin, TIterator names_end) 
     150  {} 
     151 
    136152  inline core::tPortWrapperBase &GetPort(size_t index) 
    137153  { 
Note: See TracChangeset for help on using the changeset viewer.