I don't even know how to search for that but I tried to test it, still could not understand it. What is the code below means:
boost::asio::io_service::id service::id;
Got it from: MaidSafe-CRUX at GitHub
I don't even know how to search for that but I tried to test it, still could not understand it. What is the code below means:
boost::asio::io_service::id service::id;
Got it from: MaidSafe-CRUX at GitHub
::
is the scope resolution operator. The name on the left-hand side denotes a scope; it can be either a namespace name or a class name. The name on the right-hand side denotes a member of that scope.
In your case, there seems to be a class maidsafe::crux::detail::service
, which contains a static member id
of type boost::asio::io_service::id
. In many cases, static members need an out-of-class definition, which is being provided by the code you've posted.
It can be parsed as any other C++ declaration: it declares something named service::id
of type boost::asio::io_service::id
. Let's look at the individual components.
Type:
boost
is a namespace (in global scope)asio
is a namespace inside boost
io_service
is either a namespace or class inside boost::asio
id
is a type inside boost::asio::io_service
Name:
service
is a class name (probably inside namespace maidsafe::crux::detail
)id
is a static member inside maidsafe::crux::detail::service
.Addendum
While it does not appear in this question, there's a related syntax you may sometimes encounter in more modern C++ code:
namespace maidsafe::rux::detail
{
boost::asio::io_service::id service::id;
}
This has been introduced in C++17 as a short-hand for opening multiple namespaces on one line. It's exactly equivalent to the code in the question.