c++ - boost bind or lambda functor that returns a constant -
Can I use the bind or boost lambda library to promote: that ignores its arguments and always Provides a stability?
For example an abusive physician:
complete return three (some type ARG) {return 3; }
Sure, use
boost :: Phoenix :: Val (3);
See this
#include & lt; Boost / phoenix.hpp & gt; Namespace P = Promotion: Phoenix; Namespace P: using arg_names; Int main () {auto p = p :: val (42); Return P () + P (/ * Ignored: * / 77); }
which returns 84
as the exitcode.
Comments
Post a Comment