From 0ed701f7bb8ee6862611d682ba62d509f84bc757 Mon Sep 17 00:00:00 2001 From: William Zhao <39807811+mingyzha@users.noreply.github.com> Date: Thu, 3 Aug 2017 00:13:43 +0000 Subject: [PATCH] ICU-13292 Merge the changes for fixing C4251 warning into trunk X-SVN-Rev: 40308 --- icu4c/source/i18n/collationiterator.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/icu4c/source/i18n/collationiterator.h b/icu4c/source/i18n/collationiterator.h index 2666b248fa..ff6e5ecea8 100644 --- a/icu4c/source/i18n/collationiterator.h +++ b/icu4c/source/i18n/collationiterator.h @@ -28,6 +28,21 @@ class SkippedState; class UCharsTrie; class UVector32; +/* Large enough for CEs of most short strings. */ +#define CEBUFFER_INITIAL_CAPACITY 40 + +// Export an explicit template instantiation of the MaybeStackArray that +// is used as a data member of CEBuffer. +// +// MSVC requires this, even though it should not be necessary. +// No direct access to the MaybeStackArray leaks out of the i18n library. +// +// See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples. +// +#if defined (_MSC_VER) +template class U_I18N_API MaybeStackArray; +#endif + /** * Collation element iterator and abstract character iterator. * @@ -36,10 +51,10 @@ class UVector32; */ class U_I18N_API CollationIterator : public UObject { private: - class CEBuffer { + class U_I18N_API CEBuffer { private: /** Large enough for CEs of most short strings. */ - static const int32_t INITIAL_CAPACITY = 40; + static const int32_t INITIAL_CAPACITY = CEBUFFER_INITIAL_CAPACITY; public: CEBuffer() : length(0) {} ~CEBuffer();