![]() |
Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
|
Functions | |
template<typename T> | |
void | Truncate (RepeatedPtrField< T > *array, int new_size) |
RepeatedPtrField version. | |
template<typename T> | |
void | Truncate (RepeatedField< T > *array, int new_size) |
RepeatedField version. | |
template<typename RepeatedType, typename IndexContainer = std::vector<int>> | |
int | RemoveAt (RepeatedType *array, const IndexContainer &indices) |
template<typename T, typename Pred> | |
int | RemoveIf (RepeatedPtrField< T > *array, const Pred &pr) |
template<typename T> | |
T | ParseTextOrDie (const std::string &input) |
T google::protobuf::util::ParseTextOrDie | ( | const std::string & | input | ) |
Definition at line 104 of file protobuf_util.h.
int google::protobuf::util::RemoveAt | ( | RepeatedType * | array, |
const IndexContainer & | indices ) |
Removes the elements at the indices specified by 'indices' from 'array' in time linear in the size of 'array' (on average, even when 'indices' is a singleton) while preserving the relative order of the remaining elements. The indices must be a container of ints in strictly increasing order, such as vector<int>, set<int> or initializer_list<int>, and in the range [0, N - 1] where N is the number of elements in 'array', and RepeatedType must be RepeatedField or RepeatedPtrField. Returns number of elements erased.
Assumes that 'indices' consists of [0 ... N-1].
Definition at line 50 of file protobuf_util.h.
int google::protobuf::util::RemoveIf | ( | RepeatedPtrField< T > * | array, |
const Pred & | pr ) |
For RepeatedPtrField. Removes all elements from 'array' for which unary predicate Pred pr is true. Relative ordering of elements left in the array stays the same. Returns number of removed elements. The predicate is invoked exactly once for each element of 'array' in order of its elements. Define your predicate like this: struct MyPredicate { bool operator()(const T* t) const { ... your logic ... } }; where T is going to be some derivation of ProtocolMessageGroup.
Alternatively, RepeatedPtrField supports the erase-remove idiom directly.
'write' is positioned at first element to be removed.
Definition at line 89 of file protobuf_util.h.
|
inline |
RepeatedField version.
RepeatedField::Truncate performs size validity checks.
Definition at line 36 of file protobuf_util.h.
|
inline |
RepeatedPtrField version.
Definition at line 28 of file protobuf_util.h.