It is not strictly necessary to i(define members of namespaces) inside a
namespace region. But before an entity is defined em(outside) of a namespace
it must have been declared em(inside) its namespace.

To define an entity outside of its namespace its name must be em(fully
qualified) by prefixing the member by its namespaces. The definition may be
provided at the global level or at intermediate levels in the case of nested
namespaces. This allows us to define an entity belonging to namespace tt(A::B)
within the region of namespace tt(A).

Assume the type tt(int INT8[8]) is defined in the tt(CppAnnotations::Virtual)
namespace. Furthermore assume that it is our intent to define a function
tt(squares), inside the namespace nl()
 tt(CppAnnotations::Virtual) returning a
pointer to tt(CppAnnotations::Virtual::INT8).

Having defined the prerequisites within the tt(CppAnnotations::)tt(Virtual)
namespace, our function could be defined as follows (cf. chapter ref(MEMORY)
for coverage of the memory allocation operator tt(new[])):
        verb(
    namespace CppAnnotations
    {
        namespace Virtual
        {
            void *pointer;

            typedef int INT8[8];

            INT8 *squares()
            {
                INT8 *ip = new INT8[1];

                for (size_t idx = 0; idx != sizeof(INT8) / sizeof(int); ++idx)
                    (*ip)[idx] = (idx + 1) * (idx + 1);

                return ip;
            }
        }
    }
        )
    The function tt(squares) defines an array of one tt(INT8) vector, and
returns its address after initializing the vector by the squares of the first
eight natural numbers.

    Now the function tt(squares) can be defined outside of the
tt(CppAnnotations::)tt(Virtual) namespace:
        verb(
    namespace CppAnnotations
    {
        namespace Virtual
        {
            void *pointer;

            typedef int INT8[8];

            INT8 *squares();
        }
    }

    CppAnnotations::Virtual::INT8 *CppAnnotations::Virtual::squares()
    {
        INT8 *ip = new INT8[1];

        for (size_t idx = 0; idx != sizeof(INT8) / sizeof(int); ++idx)
            (*ip)[idx] = (idx + 1) * (idx + 1);

        return ip;
    }
        )
    In the above code fragment note the following:
    itemization(
    itt(squares) is declared inside of the tt(CppAnnotations::Virtual)
namespace.
    itt() The definition outside of the namespace region requires us to use
the fully qualified name of the function em(and) of its return type.
    itt() em(Inside) the body of the function tt(squares) we are within the
tt(CppAnnotations::)tt(Virtual) namespace, so inside the function fully
qualified names (e.g., for tt(INT8)) are not required any more.
    )

    Finally, note that the function could also have been defined in the
tt(CppAnnotations) region. In that case the tt(Virtual) namespace would have
been required when defining tt(squares()) and when specifying its return type,
while the internals of the function would remain the same:
        verb(
    namespace CppAnnotations
    {
        namespace Virtual
        {
            void *pointer;

            typedef int INT8[8];

            INT8 *squares();
        }

        Virtual::INT8 *Virtual::squares()
        {
            INT8 *ip = new INT8[1];

            for (size_t idx = 0; idx != sizeof(INT8) / sizeof(int); ++idx)
                (*ip)[idx] = (idx + 1) * (idx + 1);

            return ip;
        }
    }
        )
