From 965e00d851e40acd5fdf8abd18d1c2d8582cd589 Mon Sep 17 00:00:00 2001 From: "ajwong@chromium.org" Date: Wed, 18 May 2011 20:21:12 +0000 Subject: 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 --- base/callback.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'base/callback.h') 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 sum3_cb = base::Bind(&Sum, 3); +// LOG(INFO) << sum3_cb.Run(4, 5); // Prints 12. +// +// base::Callback sum7_cb = base::Bind(&Sum, 3, 4); +// LOG(INFO) << sum7_cb.Run(10); // Prints 17. +// // // WHERE IS THIS DESIGN FROM: // -- cgit v1.1