iterating over a static std::vector

So I have a static std::vector like this:
1
2
3
4
5
6
7
static std::vector<ApiWrapper> api_handlers = {
    Rtl::RtlDuplicateUnicodeString,
    Rtl::RtlInitUnicodeString,
    Rtl::RtlPrefixUnicodeString,
    Rtl::RtlTimeToTimeFields, 
    Rtl::RtlMultiByteToUnicodeN
};


I am iterating through the vector like this:
1
2
3
4
5
6
7

   auto entry = std::find_if(ApiWrappers::api_handlers.begin(), ApiWrappers::api_handlers.end(),
                [&](ApiWrapper& handler) -> bool {
// ApiWrapper& handler members are all NULL for some reason, even though ApiWrappers is filled with initialized elements
                    return (handler->address == target_addr);
                }
            );


Why do all iterators point to empty structs, even though the vector is filled with defined elements?
Last edited on
- Can you show a minimal compileable example?
- What library is this?
- The "->" operator usually doesn't apply to a non-pointer, so it must be overloaded in some way -- how?
Last edited on
How do these structures look like? Particularly ApiWrapper?
@Ganado, the -> is for the trailing return type of the lambda, not for a pointer.
@George P
I would think that Ganado talks about that operator: handler->address
Do you check whether entry == ApiWrappers::api_handlers.end() after the call to find_if()?
Is this NULL?
 
*ApiWrappers::api_handlers.begin()
crickets
Topic archived. No new replies allowed.