C++.

#include <string>

class Widget {
private:
    std::string m_str;
public:
    explicit Widget(const std::string& str) : m_str(str) {};
};

こういうコードを書くとわたしの CLion (エディタ) が次のようなメッセージを出してくる.

Clang-Tidy: Pass by value and use std::move

なおす.

#include <string>

class Widget {
private:
    std::string m_str;
public:
    explicit Widget(std::string str) : m_str(std::move(str)) {};
};

こうすると特にメッセージ出ないのでこっちのほうがいい…, のかな.
むずかしい.