Alan Gutierrez wrote:

> Has there been any consderation given to the use of named parameters
> with boost::format?
> 
> use boost::format;
> 
> std::cout << format ("%first-name% %last-name%")
>     % format::arg("first-name", "Alan")
>     % format::arg("last-name", "Gutierrez")
>     << std::endl;
> 
> It would not be terribly difficult to implement.
> 

I did something like this some time ago.

    named_param p_name("name"), p_age("age");
    std::string your_name = get_your_name();
    unsigned int your_age = get_your_age();
    std::cout << format("{name} is {age} years old.\n",
                        p_name = your_name,
                        p_age = your_age);

IMHO, it's very useful feature.

-- 
Alexander Nasonov
Remove -mycop from my e-mail address for timely response

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to