From 4e0a37792b5bb13280afc1af6e95e58dcc4f7506 Mon Sep 17 00:00:00 2001 From: Jidong Xiao Date: Mon, 20 Nov 2023 16:47:40 -0500 Subject: [PATCH] adding functor example --- lectures/21_hash_tables_II/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lectures/21_hash_tables_II/README.md b/lectures/21_hash_tables_II/README.md index c108ea3..500baf5 100644 --- a/lectures/21_hash_tables_II/README.md +++ b/lectures/21_hash_tables_II/README.md @@ -17,11 +17,13 @@ but powerful. ```cpp class my_class_name { public: -// ... normal class stuff ... -my_return_type operator() ( /* my list of args */ ); + // ... normal class stuff ... + my_return_type operator() ( /* my list of args */ ); }; ``` +- See and run this simple functor [example](functor.cpp). + ## 21.2 Why are Functors Useful? - One example is the default 3rd argument for std::sort. We know that by default STL’s sort routines will use