Description
There are a few constexpr std::string_view
variables I declared in GraphQLService.h
for keywords in the GraphQL protocol, and they're initialized with the ""sv
operator exposed from std::literals
. To avoid bringing that using namespace
statement into every consumer of GraphQLService.h
who specifies using namespace graphql::service;
, I tried wrapping that block in an anonymous namespace, but it turns out that doesn't work. The compiler will include the using namespace
statements from anonymous namespaces anywhere the anonymous namespace is in scope.
Making it an anonymous namespace also creates code bloat and potential ODR violations elsewhere.
For the sake of backwards compatibility, code which relied on these using namespace
statements should still work, at least until the next major version of cppgraphqlgen
. I should replace the anonymous namespaces with something like inline namespace keywords
so they are implicitly in scope of the parent namespace, but they do not live in separate anonymous namespaces per translation unit.
In the next major version, I can also remove the using namespace std::literals;
statements and just explicitly initialize the constexpr std::string_view
variables with regular string literals.