On Fri, Nov 14, 2008 at 1:09 PM, Piotr Dobrogost <[EMAIL PROTECTED]>wrote:

> Jean
>
> What is the reason for allowing to set an option using a pointer?
> I think that having a version with reference is enough. The version with
> pointer is not needed and brings problems with memory management into the
> library.
>

from example01.cpp:

      myRequest.setOpt(cURLpp::Options::Url("example.com"));

      // Note that the previous line wasn't really efficient
      // because we create the option, this option is duplicated
      // for the request and then the option destructor is called.
      // You can use this instead:
      myRequest.setOpt(new cURLpp::Options::Url("example.com"));
      // Note that with this the request will use directly this
      // instance we just created. Be aware that if you pass an
      // Option pointer to the setOpt function, it will consider
      // the instance has its own instance. The Option instance
      // will be deleted when the request will be deleted, so
      // don't use the instance further in your code.

However, I would change
 setOpt(Option *)
to
 setOpt(auto_ptr<Option>)


>
> Regards
> Piotr Dobrogost
> _______________________________________________
> cURLpp mailing list
> [email protected]
> http://www.rrette.com/mailman/listinfo/curlpp
>
_______________________________________________
cURLpp mailing list
[email protected]
http://www.rrette.com/mailman/listinfo/curlpp

Reply via email to