Skip to main content
Topic: [fb2k API request] Move constructor/operator= for pfc::string8_t<> (Read 1334 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[fb2k API request] Move constructor/operator= for pfc::string8_t<>

Here is some examples that show the use of this feature:

Code: [Select]
pfc::string8 myMethod()
{
  pfc::string8 str;
  ...
  // this would result in a copy constructor now, but it would be
  // a move constructor, which is much more friendly performance-wise
  return str;
}

void myMethod2()
{
   std::vector<pfc::string8> myVec;
   ...
   // makes a lot of copies currently, which could make a huge impact on performance when there are lot of strings.
   // move constructor/assignment operator would remove the cost of moving objects around
   myVec.sort();
   ...
}

It should be 'noexcept' as well for most optimizations to work though.

Re: [fb2k API request] Move constructor/operator= for pfc::string8_t<>

Reply #1
I would in general recommend just using std::string in new code, unless pfc one is specifically needed for some feature that it provides.

Re: [fb2k API request] Move constructor/operator= for pfc::string8_t<>

Reply #2
pfc::string_8 handles utf8 string correctly: last time I tried using std::string instead it resulted in multiple number of glitches...
I will try std::string again, but I'm not holding my breath =)

 
SimplePortal 1.0.0 RC1 © 2008-2019