|
Boost : |
From: davlet_panech (davlet_panech_at_[hidden])
Date: 2002-03-01 09:14:37
--- In boost_at_y..., jk_at_s... wrote:
> 24 Feb 2002 06:44:28 +0300 davlet_panech wrote:
> >// An acceptor bound to a local address
> >acceptor_socket< tcp_ip4 > server( "localhost:80" );
>
> This form of address representation requires redundant parsing; why
not
> to represent an address as, say, net_address("localhost", 80), like:
>
> class net_address {
> const char *hostname_; // or std::string or something
> unsigned short port_;
>
> // or, may be
> // struct sockaddr_in sockaddr_;
> public:
> net_address(const char *, unsigned short);
> // etc.
> };
>
> acceptor_socket< tcp_ip4 > server( net_address("localhost", 80) );
That was my thinking exactly, the non-explicit constructor with one
parameter would allow implicit conversion from a string literal:
acceptor_socket< tcp_ip4 > svr( "localhost:80" );
- equivalent to -
acceptor_socket< tcp_ip4 > svr( net_address( "localhost:80" );
D.P.
>
> The parsing step must be leaved to external human-machine
interfacing.
>
> --
> jk
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk