LemonUIbyLemon / LemonUI

LemonUI for .NET (FiveM, RageMP, RagePluginHook and ScriptHookVDotNet 3)
MIT License
177 stars 40 forks source link

Use "const std::string&" instead of "std::string". ';' moved to the right place #50

Closed EntenKoeniq-OLD closed 2 years ago

EntenKoeniq-OLD commented 2 years ago

With "std::string" you create a copy of the string, but we don't need it.

Here is an example that it works:

class Sound
{
private:
  std::string set;

public:
  Sound(const std::string& set)
  {
    this->set = set;
  }

  void PlayFrontend()
  {
    std::cout << this->set;
  }
};

int main()
{
  Sound* testSound = new Sound("test 123");
  testSound->PlayFrontend();

  delete testSound;

  return 0;
}
justalemon commented 2 years ago

Hey, sorry for the late answer but I ended up moving the C++ version to it's own repo. Please check the LemonUI_CPP repository.