Changeset 2bf9c37 for src/Common
- Timestamp:
- Sep 1, 2017, 2:39:52 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:
- a984e65
- Parents:
- 9b18044
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
r9b18044 r2bf9c37 172 172 auto filter(Args&&... args) -> decltype(std::copy_if(std::forward<Args>(args)...)) { 173 173 return std::copy_if(std::forward<Args>(args)...); 174 } 175 176 template <typename E, typename UnaryPredicate, template< typename, typename...> class Container, typename... Args > 177 void filter( Container< E *, Args... > & container, UnaryPredicate pred, bool doDelete ) { 178 auto i = begin( container ); 179 while ( i != end( container ) ) { 180 auto it = next( i ); 181 if ( pred( *i ) ) { 182 if ( doDelete ) { 183 delete *i; 184 } // if 185 container.erase( i ); 186 } // if 187 i = it; 188 } // while 174 189 } 175 190
Note: See TracChangeset
for help on using the changeset viewer.