]> granicus.if.org Git - icu/commitdiff
ICU-13292 Merge the changes for fixing C4251 warning into trunk
authorWilliam Zhao <39807811+mingyzha@users.noreply.github.com>
Thu, 3 Aug 2017 00:13:43 +0000 (00:13 +0000)
committerWilliam Zhao <39807811+mingyzha@users.noreply.github.com>
Thu, 3 Aug 2017 00:13:43 +0000 (00:13 +0000)
X-SVN-Rev: 40308

icu4c/source/i18n/collationiterator.h

index 2666b248fa094e02348f0012a3300f738469d93e..ff6e5ecea8e5fa0ceaec41c3e1151c5a08fef63a 100644 (file)
@@ -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<int64_t, CEBUFFER_INITIAL_CAPACITY>;
+#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();