Changeset 4639b0d
- Timestamp:
- Sep 12, 2017, 7:01:34 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 7aa257ae, 7dc09294
- Parents:
- b3c7963
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
rb3c7963 r4639b0d 376 376 template< typename T, typename Func > 377 377 struct lambda_iterate_t { 378 T & ref;379 Funcf;378 const T & ref; 379 std::function<Func> f; 380 380 381 381 struct iterator { 382 382 typedef decltype(begin(ref)) Iter; 383 383 Iter it; 384 Funcf;385 iterator( Iter it, Funcf ) : it(it), f(f) {}384 std::function<Func> f; 385 iterator( Iter it, std::function<Func> f ) : it(it), f(f) {} 386 386 iterator & operator++() { 387 387 ++it; return *this; … … 391 391 }; 392 392 393 lambda_iterate_t( T & ref, Funcf ) : ref(ref), f(f) {}393 lambda_iterate_t( const T & ref, std::function<Func> f ) : ref(ref), f(f) {} 394 394 395 395 auto begin() const -> decltype(iterator(std::begin(ref), f)) { return iterator(std::begin(ref), f); } … … 398 398 399 399 template< typename... Args > 400 lambda_iterate_t<Args...> lazy_map( Args &&... args ) {401 return lambda_iterate_t<Args...>( std::forward<Args>( args )...);400 lambda_iterate_t<Args...> lazy_map( const Args &... args ) { 401 return lambda_iterate_t<Args...>( args...); 402 402 } 403 403
Note: See TracChangeset
for help on using the changeset viewer.