Namespaces
Variants
Actions

Talk:cpp/algorithm/count

From cppreference.com

"anonymous lambda" is kind of superfluous. As of today all lambda expressions in C++ are anonymous.

Either it should be "anonymous function" or just "lambda"

Good point. I've changed it from 'anonymous lambda' to 'lambda expression'. Nate 07:16, 24 September 2012 (PDT)


Is size_t the return type of count and count_if? I get compiler warnings about implicit type conversions for the example code because the function return values are put into int variables.

Suggestion: change example code so size_t type variables hold the return type from count and count_if example code.

Hal9000 (talk) 21:07, 7 February 2020 (PST)

No, "iterator_traits::difference_type" is a signed type, which is not a good design for "count" methods. I would rather add a new "count_type" as the return from these methods. Ceich62 (talk) 10:53, 18 May 2020 (PDT)
close