-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviews.gem5.org/r/2241/#review5024
-----------------------------------------------------------


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

- Nathan Binkert


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
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to