> BTW, using the ACTION_P macro being proposed now, Throw can
> be defined as
>
> ACTION_P(Throw, ex) { throw ex; }
Great. I like the ACTION macro proposal. Much more concise than what I am using now below.
template <typename A>
class ThrowAction {
public:
// Constructs an action that throws the exception 'value'.
explicit ThrowItAction(const A& value) : value_(value) {}
template <typename Result, typename ArgumentTuple>
void Perform(const ArgumentTuple& args) const {
CompileAssertTypesEqual<void, Result>();
throw value_;
}
private:
const A value_;
};
template <typename T>
PolymorphicAction<
internal::ThrowAction<T> >
Throw(const T& x) {
return MakePolymorphicAction(internal::ThrowAction<T>(x));
}
Regards,
Bruce
--- On Sat, 12/27/08, Zhanyong Wan (λx.x x) <
w...@google.com> wrote: