What is the purpose of std :: set <VALUE, std :: owner_less <VALUE>>?

I am trying to analyze this websocket ++ example https://github.com/zaphoyd/websocketpp/blob/experimental/examples/broadcast_server/broadcast_server.cpp

Line 126 is typedef std::set<connection_hdl,std::owner_less<connection_hdl>> con_list;. I wonder why this is not easy typedef std::set<connection_hdl> con_list;.

I read How Comma Operator and http://en.cppreference.com/w/cpp/memory/owner_less work, but I'm not sure what the purpose is.

What is actually stored in std::set? What does std::owner_lessit really do? What is the purpose of creating a container with this structure instead of saving connection_hdl?

+5
source share
1 answer

. A set<T> , T , .. operator < T. , ( ). - , , . std::owner_less , ( ).

+8

All Articles