Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何使用spsc_queue.pop()这个结构?_C++_Boost_Struct_Queue_Lock Free - Fatal编程技术网

C++ 如何使用spsc_queue.pop()这个结构?

C++ 如何使用spsc_queue.pop()这个结构?,c++,boost,struct,queue,lock-free,C++,Boost,Struct,Queue,Lock Free,我正在尝试spsc\u queue.pop()thisstruct enum action_type { SUBSCRIBE, UNSUBSCRIBE, MESSAGE }; struct action { action() = default ; action(action_type t, connection_hdl h) : type(t), hdl(h) {} action(action_type t, server::message_p

我正在尝试
spsc\u queue.pop()
this
struct

enum action_type {
    SUBSCRIBE,
    UNSUBSCRIBE,
    MESSAGE
};

struct action {
    action() = default ;
    action(action_type t, connection_hdl h) : type(t), hdl(h) {}
    action(action_type t, server::message_ptr m) : type(t), msg(m) {}

    action_type type;
    websocketpp::connection_hdl hdl;
    server::message_ptr msg;
};

但是每当我用

std::cout << "'" << a.type << "'" << std::endl;

std::coutSUBSCRIBE
的值为
0
。如果要给
SUBSCRIBE
一个不同的值,可以初始化枚举数,例如,使用
1

enum action_type {
    SUBSCRIBE = 1,
    UNSUBSCRIBE,
    MESSAGE
};
其他枚举数将获得相应的下一个整数值

enum action_type {
    SUBSCRIBE = 1,
    UNSUBSCRIBE,
    MESSAGE
};