Macro for static std::string object from literal

前端 未结 5 2172
萌比男神i
萌比男神i 2021-02-12 17:56

Suppose I need to call a function foo that takes a const std::string reference from a great number of places in my code:

int foo(const          


        
5条回答
  •  悲哀的现实
    2021-02-12 18:13

    You could use Boost.Flyweight to make a key-value flyweight from const char* to std::string. I'm not sure about the details, might be that it is enough to use flyweight everywhere.

提交回复
热议问题