summaryrefslogtreecommitdiffstats
path: root/base/callback.h
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 20:21:12 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 20:21:12 +0000
commit965e00d851e40acd5fdf8abd18d1c2d8582cd589 (patch)
tree8e8abfc7456bd7634880fa2fe03b1fba811e868f /base/callback.h
parent80a82dbb10fc04429f930e5842fa1e3432096123 (diff)
downloadchromium_src-965e00d851e40acd5fdf8abd18d1c2d8582cd589.zip
chromium_src-965e00d851e40acd5fdf8abd18d1c2d8582cd589.tar.gz
chromium_src-965e00d851e40acd5fdf8abd18d1c2d8582cd589.tar.bz2
Add in example for prebinding.
BUG=none TEST=none. Comment change. Review URL: http://codereview.chromium.org/7019024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85806 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/callback.h')
-rw-r--r--base/callback.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/base/callback.h b/base/callback.h
index fbd81d8..7f9b548 100644
--- a/base/callback.h
+++ b/base/callback.h
@@ -97,6 +97,16 @@
// LOG(INFO) << bound_copy_cb.Run(); // Prints 1.
// LOG(INFO) << bound_ref_cb.Run(); // Prints 2.
//
+// /* Currying parameters. This also works for methods. */
+// int Sum(int a, int b, int c) {
+// return a + b + c;
+// }
+// base::Callback<int(int, int)> sum3_cb = base::Bind(&Sum, 3);
+// LOG(INFO) << sum3_cb.Run(4, 5); // Prints 12.
+//
+// base::Callback<int(int)> sum7_cb = base::Bind(&Sum, 3, 4);
+// LOG(INFO) << sum7_cb.Run(10); // Prints 17.
+//
//
// WHERE IS THIS DESIGN FROM:
//