Move get_cont_octet_out_count_impl from unnamed namespace to namespace detail. Workaround for unnamed namespace symbols having external linkage prior to C++11, which causes duplicate symbol errors in libraries (for example filesystem) that link in multiple object files (differing only in namespaces) built from the same source file, allowing two versions to exist side-by-side in the same lib or dll.

This commit is contained in:
Beman
2014-09-01 07:29:57 -04:00
parent 275643c97b
commit 5ef03bffe3

View File

@ -216,9 +216,9 @@ unsigned int utf8_codecvt_facet::get_octet_count(
else if (0xf8 <= lead_octet && lead_octet <= 0xfb) return 5;
else return 6;
}
BOOST_UTF8_END_NAMESPACE
namespace {
namespace detail {
template<std::size_t s>
int get_cont_octet_out_count_impl(wchar_t word){
if (word < 0x80) {
@ -269,15 +269,14 @@ int get_cont_octet_out_count_impl<4>(wchar_t word){
#endif
}
} // namespace anonymous
} // namespace detail
BOOST_UTF8_BEGIN_NAMESPACE
// How many "continuing octets" will be needed for this word
// == total octets - 1.
int utf8_codecvt_facet::get_cont_octet_out_count(
wchar_t word
) const {
return get_cont_octet_out_count_impl<sizeof(wchar_t)>(word);
return detail::get_cont_octet_out_count_impl<sizeof(wchar_t)>(word);
}
BOOST_UTF8_END_NAMESPACE