Macro for static std::string object from literal

前端 未结 5 2162
萌比男神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:21

    If you can use boost 1.55 or greater you can do

    #include 
    
    void foo(const boost::string_ref& xyz)
    {
    }
    

提交回复
热议问题