I am familiar with the use of std::has_facet(loc) to determine whether a specific facet has been loaded into a locale.
if ( ! std::has_facet<custom_facet_t>(std::cout.getloc()) ) {
/* load facet in to locale */
}
Is there a way to get a list of all facets currently loaded? Given the nature of locales, I am fairly certain that it would violate all types of rules... but I had to ask :) .
I believe (as you've surmised) that the answer is no. The locale
class supports construction, assignment, name retrieval, comparison (or equality and inequality only), and function-invocation. The only (required) free functions are use_facet
and has_facet
, along with the is*
and to*
convenience interfaces.
There's simply nothing there that looks like it can support enumeration/traversal/iteration.