Boost logo

Boost :

Subject: Re: [boost] An extension to boost::variant
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-02-09 13:39:31

Chris Hamilton wrote:

> The reason I want this, is to have a nice String variant, that
> encapsulates the various forms a string can take in a current project:
> std::strings, char*'s, and std::string* and
> boost::shared_ptr<std::string>. I want functions to be able to handle
> all of these types transparently by using variants as the argument
> types. Allowing "const std::string&" as a variant type allows this to
> be done while not requiring a wasteful string copy.

Why can't you simply use std::pair<const char*, size_t>?
That seems to cover all possibilities already... (assuming std::string
is contiguous, which is true in the real world).

Boost list run by bdawes at, gregod at, cpdaniel at, john at