C++ initializer_list 简单测试
#include <iostream>
#include <string>
static void  show_msg(std::initializer_list<std::string> str_list)
{
    for (auto beg = str_list.begin(); beg != str_list.end(); ++beg)
    {
        std::cout << *beg << std::endl;
    }
}
int main()
{
    show_msg({ "hello", "world", "good", "morning" });
    return EXIT_SUCCESS;
}
输出:
hello
world
good
morning
 
                    
                     
                    
                 
                    
                 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号