Ignore:
Timestamp:
Mar 13, 2025, 9:26:17 AM (7 weeks ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
8b639f9
Parents:
3bd9508 (diff), 594671a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

fix pull conflicit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/Common/Iterate.hpp

    r3bd9508 r3e91c6f9  
    208208        return group_iterate_t<Args...>( std::forward<Args>( args )... );
    209209}
    210 
    211 // -----------------------------------------------------------------------------
    212 // Helper struct and function to support
    213 // for ( val : lazy_map( container1, f ) ) {}
    214 // syntax to have a for each that iterates a container,
    215 // mapping each element by applying f.
    216 
    217 template< typename T, typename Func >
    218 struct lambda_iterate_t {
    219         const T & ref;
    220         std::function<Func> f;
    221 
    222         struct iterator {
    223                 typedef decltype(begin(ref)) Iter;
    224                 Iter it;
    225                 std::function<Func> f;
    226                 iterator( Iter it, std::function<Func> f ) : it(it), f(f) {}
    227                 iterator & operator++() {
    228                         ++it; return *this;
    229                 }
    230                 bool operator!=( const iterator &other ) const { return it != other.it; }
    231                 auto operator*() const -> decltype(f(*it)) { return f(*it); }
    232         };
    233 
    234         lambda_iterate_t( const T & ref, std::function<Func> f ) : ref(ref), f(f) {}
    235 
    236         auto begin() const -> decltype(iterator(std::begin(ref), f)) { return iterator(std::begin(ref), f); }
    237         auto end() const   -> decltype(iterator(std::end(ref), f)) { return iterator(std::end(ref), f); }
    238 };
    239 
    240 template< typename... Args >
    241 lambda_iterate_t<Args...> lazy_map( const Args &... args ) {
    242         return lambda_iterate_t<Args...>( args...);
    243 }
    244 
    245 // Local Variables: //
    246 // tab-width: 4 //
    247 // mode: c++ //
    248 // compile-command: "make install" //
    249 // End: //
Note: See TracChangeset for help on using the changeset viewer.