Boost logo

Boost :

Subject: Re: [boost] Boost review of the Convert library is ongoing
From: alex (alexhighviz_at_[hidden])
Date: 2014-05-22 06:40:05


>From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of Vladimir
>>On 05/22/2014 01:54 AM, feverzsj wrote:
>> hi, list
>> here are some personal opinions/thoughts on the convert lib:
>>
>> 1. in most cases, I found directly use of the converter would be more
>> convenient:
>>
>
>Indeed, converters can be called directly. However, I advocate that
>calling various conversions via one(!) familiar/known boost::convert()
>interface ensures *known* behavior, better readability, better
>adaptivity to requirement changes (when one needs to upgrade/replace
>already deployed converter, etc.).

If you really want only one known convert interface, maybe your design
should reflect that. At the moment you have one familiar / known interface
for converter developers (success = cvr.from(in, out)) and one for converter
users (out = convert<int>::from(in, cvr)). Whereby the boost::convert<> acts
as the middle man. Anybody looking for efficiency will consider eliminating
the middle man.

I don't see the problem of having two familiar/known interfaces; I believe
it is quite usual to have convenience functions for users.

Alex


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk