Meaning of double colons ::

Can someone please explain what the following code does, especially the last line that uses the "::" operator. What does that operator mean in this context? Thanks.

template<unsigned long num>
struct binary
{
static unsigned const value =
binary<num/10>::value << 1 | num % 10;
};
Last edited on
This is a recursively defined template structure. The value field depends on the value field of the next iteration. Because the value field is static, it must be accessed using the scope operator. So, if num == 111, we need to access the static value field of binary<11>, which is binary<11>::value.
Topic archived. No new replies allowed.