Boost logo

Boost :

From: Daniel James (daniel_at_[hidden])
Date: 2004-11-18 17:35:08

Jonathan Wakely wrote:
> Could you supply an extra arg to the macro, specifying whether to define
> the nullary overload for the cases where it is wanted and valid ?

Yep, or maybe minimum, maximum parameter arguments. Although, if the
macro gets complex enough to invoke, it'll probably be better just to
write it out manually. For example, your tolower test becomes:

     #include <string>
     #include <algorithm>
     #include <cctype>

     struct {
         template <class T>
         T operator()(T x) { return std::tolower(x); }
     } tolower_visitor;

     int main()
         std::string s("FNORD");
         std::transform(s.begin(), s.end(), s.begin(),

Which is perhaps better since it has the correct return type.


Boost list run by bdawes at, gregod at, cpdaniel at, john at