Seems like a good idea.
Here's a quick thought - I think c++11 is not really an obj.toString() kind
of language (like Java or C#). Would it make sense to add std::to_string()
and std::to_wstring() equivalents for CacheableString? This might mean
implementing following functions:
std::string to_string(CacheableString value);
std::wstring to_wstring(CacheableString value);
So that we can do something like:
std::cout << std::to_wstring(pdxser);
Thanks,
David
On Thu, Sep 14, 2017 at 11:10 AM, Michael William Dodge <[email protected]>
wrote:
> +1 for std::string and std::wstring.
>
> Sarge
>
> > On 14 Sep, 2017, at 11:10, Mark Hanson <[email protected]> wrote:
> >
> > Hi All,
> >
> > I wanted to broach the subject of moving away from moving away from
> CacheableStringPtrs for the toString representation of Serializable. It
> would seem desirable to move to std::string and std::wstring to use more
> basic types that would be faster to log and the code would be simpler for a
> user.
> >
> > Are there any opinions on this subject?
> >
> > Here is a before and after look at a chunk of code
> >
> > Before
> >
> > CacheableStringPtr ptr = pdxser->toString();
> > if (ptr->isWideString()) {
> > printf(" query idx %d pulled object %S :: \n", i,
> > ptr->asWChar());
> > } else {
> > printf(" query idx %d pulled object %s :: \n", i,
> > ptr->asChar());
> > }
> >
> > After
> >
> >
> > if (pdxser->isWideString()) {
> > std::cout << " query idx “ << i << "pulled object ” <<
> pdxser->toWString() << std::endl;
> > } else {
> > std::cout << " query idx “ << i << "pulled object ” <<
> pdxser->toString() << std::endl;
> > }
> >
> >
> > Thanks,
> > Mark
>
>