Now I remember what the issue is. Sorry about the earlier confusion. The problem is that the constructor for auto_ptr is "explicit" so you'd have to do this:
StringSource s(message, true, std::auto_ptr<BufferedTransformation>(new HexEncoder));
instead of
StringSource s(message, true, new HexEncoder);
I wanted to avoid having to do the extra typing.
Yeah, it is a PITA. I'd probably vote for extra typing that brings clarity to the interface, though. It's would be hard for anyone even slightly knowledgeable about the standard library to get it wrong at that point. Here is one solution. Create a named constructor like this:
static std::auto_ptr<BufferedTransformation> HexEncoder::CreateForSink()
{ return std::auto_ptr<BufferedTransformation>(new HexEncoder) }Then the syntax would be:
StringSource s(message, true, HexEncoder::CreateForSink());
Scott Maxwell PocketPurchase, Inc.
Scott
