[Libreoffice-commits] core.git: sw/inc

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Sat Dec 6 22:59:43 PST 2014


 sw/inc/ring.hxx |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 31e8084fc07c3de09230c0f0c6ed947b3de98df1
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Dec 6 16:28:34 2014 +0100

    trying to fix Windows breaker into the blind
    
    - ring.hxx(246) : error C2440: ´<function-style-cast>´ : cannot convert
      from ´const SwViewShell *´ to ´sw::RingIterator<const value_type>´
    - ring.hxx(250) : error C2665: ´sw::RingIterator<const
      value_type>::RingIterator´ : none of the 3 overloads could convert all
      the argument types
    - only tested on gcc-4.8 here
    
    Change-Id: I181b8a694834133ef31a4a89bf93c90e3ce63b54
    Reviewed-on: https://gerrit.libreoffice.org/13334
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
    Tested-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>

diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx
index 9c49946..b4cb4a0 100644
--- a/sw/inc/ring.hxx
+++ b/sw/inc/ring.hxx
@@ -154,6 +154,7 @@ namespace sw
         private:
             /** the item in the ring where iteration starts */
             value_type* m_pStart;
+            typedef typename std::remove_const<value_type>::type nonconst_value_type;
 
         public:
             RingContainer( value_type* pRing ) : m_pStart(pRing) {};
@@ -201,9 +202,9 @@ namespace sw
                 : m_pCurrent(nullptr)
                 , m_pStart(nullptr)
             {}
-            explicit RingIterator(value_type* pRing, bool bStart = true)
+            explicit RingIterator(nonconst_value_type* pRing, bool bStart = true)
                 : m_pCurrent(nullptr)
-                , m_pStart(const_cast<nonconst_value_type*>(pRing))
+                , m_pStart(pRing)
             {
                 if(!bStart)
                     m_pCurrent = m_pStart;
@@ -239,23 +240,23 @@ namespace sw
 
     template <typename value_type>
     inline typename Ring<value_type>::const_ring_container Ring<value_type>::GetRingContainer() const
-        { return Ring<value_type>::const_ring_container(static_cast< const value_type* >(this)); };
+        { return Ring<value_type>::const_ring_container(static_cast< const_value_type* >(this)); };
 
     template <typename value_type>
     inline typename RingContainer<value_type>::iterator RingContainer<value_type>::begin()
-        { return RingContainer<value_type>::iterator(m_pStart); };
+        { return RingContainer<value_type>::iterator(const_cast< nonconst_value_type* >(m_pStart)); };
 
     template <typename value_type>
     inline typename RingContainer<value_type>::iterator RingContainer<value_type>::end()
-        { return RingContainer<value_type>::iterator(m_pStart, false); };
+        { return RingContainer<value_type>::iterator(const_cast< nonconst_value_type* >(m_pStart), false); };
 
     template <typename value_type>
     inline typename RingContainer<value_type>::const_iterator RingContainer<value_type>::begin() const
-        { return RingContainer<value_type>::const_iterator(m_pStart); };
+        { return RingContainer<value_type>::const_iterator(const_cast< nonconst_value_type* >(m_pStart)); };
 
     template <typename value_type>
     inline typename RingContainer<value_type>::const_iterator RingContainer<value_type>::end() const
-        { return RingContainer<value_type>::const_iterator(m_pStart, false); };
+        { return RingContainer<value_type>::const_iterator(const_cast< nonconst_value_type* >(m_pStart), false); };
 }
 #endif
 


More information about the Libreoffice-commits mailing list