Boost logo

Boost :

From: x.lsi.maillard_at_[hidden]
Date: 2001-12-25 17:53:22


                THIS IS AN AUTOMATICALLY GENERATED REPLY
                   Your mail to me has been discarded

Hi! You have reached the mail filter of one Richard Gooch. I'm sorry
to have to do this to you, but I am now filtering my email to combat
the flood of junk email (spam) that I receive. I'm fed up with having
to waste my time sifting through junk email. This filter also protects
me from certain types of mailbombing attacks.

I received an email from you, but my mail filter doesn't think you
sent it to me personally. This may be because I am on some mailing
list I'm not aware of. It may also have come from a mailing list I
*am* subscribed to, but the list adminstrators have started fiddling
with (breaking) the listserver.
APOLOGIES if the mailing list is genuine (i.e. not a spam list). If
you receive this reply because of a message you sent to a genuine
mailing list, please send me a message (telling me which mailing list
I'm on) with the following in the subject line:

293977

This is my password of the week. My mail filter will then let me see
the message. NOTE: the password MUST be in the subject, not the body.
I will then add a rule for the mailing list (or unsubscribe myself if
I don't wish to be subscribed) so that this won't happen again. I
apologise to people subscribed to mailing lists if this message is
sent to the whole list; I have taken considerable care to make sure
that mailing lists I want to be subscribed to are not affected by my
spam filter.

NOTE TO BULK EMAIL ADVERTISERS, SPAMMERS AND OTHER PARASITES: if you
manage to break through my filtering, rest assured that I will ignore
your message on principle. Future mails will be automatically deleted.
Unsolicited commercial email is unwelcome and costs *me* time to deal
with.

The message you apparently sent to me follows:

>From fxgs Tue Dec 25 23:53:21 2001
Return-Path: <sentto-1234907-19300-1009170545-x.lsi.maillard=wanadoo.fr_at_[hidden]>
Delivered-To: fxgs_at_localhost.hometranet.home
Received: from 192.168.1.2 [192.168.1.2]
        by localhost with POP3 (fetchmail-5.9.0)
        for fxgs_at_localhost (single-drop); Tue, 25 Dec 2001 23:53:21 +0100 (CET)
Received: from localhost (localhost.localdomain [127.0.0.1])
        by mail.hometranet.home (Postfix) with ESMTP id 0F0C92B075
        for <fxgs_at_localhost>; Tue, 25 Dec 2001 18:49:53 -0500 (EST)
Received: from pop.wanadoo.fr
        by localhost with POP3 (fetchmail-5.7.4)
        for fxgs_at_localhost (single-drop); Tue, 25 Dec 2001 18:49:53 -0500 (EST)
Received: from anagyris.wanadoo.fr (192.168.156.16) by ms4-2.wanadoo.fr; 24 Dec 2001 06:09:09 +0100
Received: from n5.groups.yahoo.com (216.115.96.55) by anagyris.wanadoo.fr; 24 Dec 2001 06:09:08 +0100
X-eGroups-Return: sentto-1234907-19300-1009170545-x.lsi.maillard=wanadoo.fr_at_[hidden]
Received: from [216.115.97.165] by n5.groups.yahoo.com with NNFMP; 24 Dec 2001 05:09:04 -0000
X-Sender: rogeeff_at_[hidden]
X-Apparently-To: boost_at_[hidden]
Received: (EGP: mail-8_0_1_3); 24 Dec 2001 05:09:03 -0000
Received: (qmail 88247 invoked from network); 24 Dec 2001 05:09:03 -0000
Received: from unknown (216.115.97.167)
  by m11.grp.snv.yahoo.com with QMQP; 24 Dec 2001 05:09:03 -0000
Received: from unknown (HELO n13.groups.yahoo.com) (216.115.96.63)
  by mta1.grp.snv.yahoo.com with SMTP; 24 Dec 2001 05:09:01 -0000
Received: from [216.115.96.118] by n13.groups.yahoo.com with NNFMP; 24 Dec 2001 04:58:44 -0000
To: boost_at_[hidden]
Message-ID: <a06d9c+pouc_at_[hidden]>
User-Agent: eGroups-EW/0.82
X-Mailer: Yahoo Groups Message Poster
From: "rogeeff" <rogeeff_at_[hidden]>
X-Originating-IP: 24.190.34.70
X-Yahoo-Profile: rogeeff
MIME-Version: 1.0
Mailing-List: list boost_at_[hidden]; contact boost-owner_at_[hidden]
Delivered-To: mailing list boost_at_[hidden]
Precedence: bulk
List-Unsubscribe: <mailto:boost-unsubscribe_at_[hidden]>
Date: Mon, 24 Dec 2001 05:09:00 -0000
Subject: [boost] proposition to update the lexical_cast
Reply-To: boost_at_[hidden]
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Status: O

Hi, all

Recently I have used lexical_cast extensively. And I found it
disapointing that I can't make it more effitient in some particular
cases where it could be very simple. The only thing that I need is a
bit flexibility of lexical_cast implementation. So I end up with the
following implementation:

template<class Stream, class Source>
static void default_upload_impl( Stream& interpreter, Source const&
arg )
{
    if( !(interpreter << arg) )
        throw bad_lexical_cast();
}

template<class Stream, class Target>
static void default_unload_impl( Stream& interpreter, Target& result )
{
    if( !(interpreter >> result) ||
        !(interpreter >> std::ws).eof())
        throw bad_lexical_cast();
}

template<class Source>
struct lexical_cast_interpreter {
    explicit lexical_cast_interpreter( Source const& ){}

    void upload( Source const& arg ) {
default_upload_impl( m_interpreter, arg ); }

    template<class Target>
    void unload( Target& result ) {
default_unload_impl( m_interpreter, result ); }

private:
    string_stream m_interpreter;
};

} // namespace detail

template<class Target,class Source>
Target lexical_cast(Source const& arg)
{
    detail::lexical_cast_interpreter<Source> interpreter( arg );

    interpreter.upload( arg );

    Target result;

    interpreter.unload( result );

    return result;
}

} // namespace boost

Now to speed up a lexical_cast from std::string I am able to write a
specialization:

namespae detail {

template<>
struct lexical_cast_interpreter<std::string> {
    explicit lexical_cast_interpreter( std::string const&
arg )
    : m_interpreter( arg.data(), arg.size() ) {}

    void upload( std::string const& ) {}

    template<class Target>
    void unload( Target& result ) {
default_unload_impl( m_interpreter, result ); }

private:
    in_string_stream m_interpreter;
};

} // namespace detail

Code and small performance comparison program is located here:

http://groups.yahoo.com/group/boost/files/lexical_cast_propositions/pr
oposition1.cpp

Regards,

Gennadiy.

Info: http://www.boost.org Send unsubscribe requests to: <mailto:boost-unsubscribe_at_[hidden]>

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


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