Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/helpers.hpp

    r7dad10 r6e97e5  
    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.