|
Boost : |
Subject: Re: [boost] Formal Review Request: Boost.Convert
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-02-26 15:07:50
On Thursday, February 26, 2009 3:03 PM
Emil Dotchevski wrote:
>
> If I'm the maintainer of class uuid and I am asked to provide a
> to-string conversion, you'll find it very difficult to convince me
> that it makes sense to replace this:
>
> #include <string>
>
> namespace user {
> class uuid;
> std::string to_string( uuid const & );
> }
>
> with all of this:
>
> #include <boost/mpl/and.hpp>
> #include <boost/mpl/bool.hpp>
> #include <boost/typeof/typeof.hpp>
> #include <boost/utility/enable_if.hpp>
> #include <boost/type_traits/is_integral.hpp>
> #include <boost/parameter/keyword.hpp>
>
> #include <kitchen_sink.hpp>
>
> namespace user {
>
> struct uuid
> {
> unsigned char value_[16];
> };
>
> struct uuid_to_string_tag {};
>
> template< typename ToT >
> typename boost::enable_if<
> boost::conversion::is_string< ToT >,
> uuid_to_string_tag
> >::type get_conversion_tag(uuid*, ToT*);
>
> } // namespace user
>
> namespace boost {
>
> namespace conversion {
>
> template< typename ToT >
> struct converter_impl< ToT, user::uuid_to_string_tag >
> {
> typedef ToT result_type;
>
> template< typename ArgsT >
> ToT operator() (ArgsT const& args) const
> {
> ....
> }
> };
>
> } // namespace conversion
>
> } // namespace boost
That's a bit unfair, don't you think? I know that you only wish to support std::string conversions, but the more complex machinery shown in the latter variant supports open ended formatting options and various target types.
_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk