> On April 23, 2014, 5:01 p.m., Nathan Binkert wrote: > > This is cool, but it'd be better to just change FunctorProxy to be more > > generic. If FunctorProxy held a std::function<Counter()> (instead of the > > T*), then anything that took no arguments and returned a stats::Counter > > could be used. This would allow pretty much everything to be used: > > functions, classes, lambdas, and anything in <functional>. For the > > specific case you're trying to solve for, you could simply use a lambda or > > std::mem_fn and std::bind to wrap objects. > > > > Check out: http://en.cppreference.com/w/cpp/utility/functional > > Ali Saidi wrote: > I learn something new every day... but unfortunately, i don't think gcc > 4.4 supports std::bind > > Nathan Binkert wrote: > Wow, is 4.4 the minimum version? You guys should move forward. Pretty > easy to get newer compilers than that on almost any system. > > You could use boost::bind for ancient versions. std::bind was basically > lifted from boost.
Good point, Nate. I actually had a look at these (not only to figure out the template craziness) as well, but came to the same conclusion as Ali. And I am not too sure about boost, I get a mixed (at best) vibe about it around here ;-) - Stephan ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://reviews.gem5.org/r/2241/#review5023 ----------------------------------------------------------- On April 23, 2014, 12:21 p.m., Andreas Hansson wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > http://reviews.gem5.org/r/2241/ > ----------------------------------------------------------- > > (Updated April 23, 2014, 12:21 p.m.) > > > Review request for Default. > > > Repository: gem5 > > > Description > ------- > > Changeset 10193:ae6a0ea78f4f > --------------------------- > stats: Method stats source > > This source for stats binds an object and a method / function from the object > to a stats object. This allows pulling out stats from object methods without > needing to go through a global, or static shim. > > Syntax is somewhat unpleasant, but the templates and method pointer type > specification were quite tricky. Interface is very clean though; and similar > to .functor > > > Diffs > ----- > > src/base/statistics.hh e40b35147270 > > Diff: http://reviews.gem5.org/r/2241/diff/ > > > Testing > ------- > > > Thanks, > > Andreas Hansson > > _______________________________________________ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev