Changeset 1340 for cpp/common/util-stl.h


Ignore:
Timestamp:
05/06/25 23:06:50 (2 days ago)
Author:
Maciej Komosinski
Message:

Added helper functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/util-stl.h

    r1288 r1340  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2023  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2025  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    2626        if (it != v.end())
    2727                v.erase(it);
     28}
     29
     30// c++17 implementation of c++20 std::vector::erase_if()
     31template<typename T,typename P> void erase_if(vector<T>& v, P predicate)
     32{
     33        v.erase(std::remove_if(v.begin(), v.end(), predicate), v.end());
    2834}
    2935
Note: See TracChangeset for help on using the changeset viewer.