Skip to content

What is the meaning of operator[](T* key) #645

Description

@scinart

What's the meaning of the following code?

abbreviated version from json.hpp:

template<typename T, std::size_t n>
reference operator[](T * (&key)[n])
{
    return operator[](static_cast<const T>(key));
}
template<typename T>
reference operator[](T* key)
{
    return m_value.object->operator[](key);
}

and const_reference version of them.

Normally m_value.object is an std::map and key is an std::string. But the code must have been placed for a reason. I just want to know why.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions