Changes in src/Common/utility.h [3c09d47:2bf9c37]
- File:
-
- 1 edited
-
src/Common/utility.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
r3c09d47 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.