[MOAB-dev] Discussion on return type of MOAB routines

Jed Brown jed at jedbrown.org
Wed Jan 22 10:16:20 CST 2014


"Wu, Danqing" <wuda at mcs.anl.gov> writes:

> The object contains an enum type ErrorCode and std::string. The size
> of this object is fixed, like 16 bytes in my test. However,
> std::string is essential like a wrapped pointer implemented by
> STL. 

Yes, do you really want your error handler to use dynamic memory allocation?

> Here I think the "size" Tim mentions is related to the length of the
> string, which will affect the performance of the copy constructor of
> std::string, when this object is returned by value from MOAB routines.

You could use a pointer so that there is no copy, but you have to
allocate the string somewhere.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/moab-dev/attachments/20140122/922f68ec/attachment.pgp>


More information about the moab-dev mailing list