c++ Programming Glossary: unary_function
Using a std::tuple as key for std::unordered_map http://stackoverflow.com/questions/11408934/using-a-stdtuple-as-key-for-stdunordered-map tuple std string int char key_t struct key_hash public std unary_function key_t std size_t std size_t operator const key_t k const return..
Is it possible to hash pointers in portable C++03 code? http://stackoverflow.com/questions/14167455/is-it-possible-to-hash-pointers-in-portable-c03-code T struct myhash template typename T struct myhash T std unary_function T std size_t std size_t operator T const ptr const return ..
iterate vector, remove certain items as I go http://stackoverflow.com/questions/1604588/iterate-vector-remove-certain-items-as-i-go #include algorithm for remove_if #include functional for unary_function struct delete_file public std unary_function const std string.. for unary_function struct delete_file public std unary_function const std string bool bool operator const std string strPath..
Can a functor retain values when passed to std::for_each? http://stackoverflow.com/questions/2102187/can-a-functor-retain-values-when-passed-to-stdfor-each probably need to supply your own functor and use count_if unary_function lives in functional struct is_face_up std unary_function const.. unary_function lives in functional struct is_face_up std unary_function const Card const bool const bool operator const card pC const..
Is there a Java Map keySet() equivalent for C++'s std::map? http://stackoverflow.com/questions/2467000/is-there-a-java-map-keyset-equivalent-for-cs-stdmap not you should template typename Pair struct select1st std unary_function const Pair const typename Pair first_type const typename Pair..
Good hash function for a 2d index http://stackoverflow.com/questions/2634690/good-hash-function-for-a-2d-index came up with the following struct PointHash public std unary_function Point std size_t result_type operator const argument_type val..
How can I negate a functor in C++ (STL)? http://stackoverflow.com/questions/265228/how-can-i-negate-a-functor-in-c-stl STL functional library . By deriving your predicate from unary_function SomeType bool you'll then be able to use the not1 function which.. Here is how you could do that struct FindPredicate public unary_function SomeType bool FindPredicate const SomeType t _t t bool operator..
How to negate a predicate function using operator ! in C++? http://stackoverflow.com/questions/4583310/how-to-negate-a-predicate-function-using-operator-in-c however the output is nothing struct my_is_digit std unary_function bool char bool operator char c const return isdigit c std unary_negate.. derive your my_is_digit functor from the utility class std unary_function char bool . This is purely a typedef helper and adds no runtime.. #include iostream #include ostream struct my_is_digit std unary_function char bool bool operator char c const return c '0' c '9' std..
C++ Logging and performance tuning library http://stackoverflow.com/questions/4727006/c-logging-and-performance-tuning-library label_ static times TimeMap struct extract_key public std unary_function times value_type key_type std string operator times value_type.. r const return r.first struct extract_val public std unary_function times value_type time_type time_type operator times value_type.. r const return r.second struct match_key public std unary_function times value_type bool match_key key_type const key_ key key_..
Vectors, structs and std::find http://stackoverflow.com/questions/589985/vectors-structs-and-stdfind don't have boost. Would look like this struct find_id std unary_function monster bool DWORD id find_id DWORD id id id bool operator monster..
Using local classes with STL algorithms http://stackoverflow.com/questions/742607/using-local-classes-with-stl-algorithms 10 std vector int v array array 10 struct even public std unary_function int bool bool operator int x return x 2 std remove_if v.begin..
What can and can't I specialize in the std namespace? http://stackoverflow.com/questions/8513417/what-can-and-cant-i-specialize-in-the-std-namespace and a constexpr value constructor. The class templates unary_function and binary_function are deprecated. A program shall not declare..
|