Ignore:
Timestamp:
Mar 17, 2010, 3:19:56 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
Children:
43ed42
Parents:
d639c7
git-author:
Tillmann Crueger <crueger@…> (03/17/10 14:53:26)
git-committer:
Tillmann Crueger <crueger@…> (03/17/10 15:19:56)
Message:

Added a generic Iterator that can be used to iterate only over certain parts of an internal data structure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/helpers.hpp

    rd639c7 r5738177  
    189189#define PLURAL_S(v) (((v)==1)?"":"s")
    190190
     191// this is to allow different modes of access for
     192// maps and sets
     193template<typename Res,typename T>
     194struct _take{
     195  Res get(T value) const;
     196};
     197
     198// if we have a set,vector etc we can directly access the result
     199template<typename Res>
     200struct _take<Res,Res>{
     201  static inline Res get(Res value){
     202    return value;
     203  }
     204};
     205
     206// if we have a map we have to access the second part of
     207// the pair
     208template<typename Res,typename T1>
     209struct _take<Res,std::pair<T1,Res> >{
     210  static inline Res get(std::pair<T1,Res> value){
     211    return value.second;
     212  }
     213};
     214
    191215#endif /*HELPERS_HPP_*/
Note: See TracChangeset for help on using the changeset viewer.