]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Debug for Mantis23293. Specific implementation for GCC6 + C++11
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 11 Jul 2016 16:17:45 +0000 (18:17 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 11 Jul 2016 16:17:45 +0000 (18:17 +0200)
src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx
src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx

index f64108a8ab251b3fc99aba5a415775b6c7ae0f02..782d756e5fcc8b27dcf889e953e1ef3283ad9c96 100644 (file)
@@ -459,22 +459,49 @@ Value *ExprParser::evaluateLowLev(Value *valGen) const
   return stackOfVal.back();
 }
 
+#if __cplusplus >= 201103L
+
+ExprParser::ExprParser(ExprParser&& other):_father(other._father),_leaf(other._leaf),_is_parsing_ok(std::move(other._is_parsing_ok)),_expr(std::move(other._expr)),_sub_expr(std::move(other._sub_expr)),_func_btw_sub_expr(std::move(other._func_btw_sub_expr))
+{
+  other._leaf=0;
+}
+
+ExprParser& ExprParser::operator=(ExprParser&& other)
+{
+  _father=other._father;
+  _is_parsing_ok=std::move(other._is_parsing_ok);
+  _leaf=other._leaf;
+  _expr=std::move(other._expr);
+  _sub_expr=std::move(other._sub_expr);
+  _func_btw_sub_expr=std::move(other._func_btw_sub_expr);
+  other._leaf=other._leaf;
+  other._leaf=0;
+  return *this;
+}
+
+#endif
+
 void ExprParser::reverseThis()
 {
   if(_leaf)
     return ;
   for(std::vector<ExprParser>::iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++)
     (*iter).reverseThis();
-  AutoPtr<char> buf(new char[sizeof(ExprParser)]);
-  char *loc(reinterpret_cast<char *>(&_sub_expr[0])),*bufPtr(buf);
   std::size_t sz(_sub_expr.size());
   std::size_t nbOfTurn(sz/2);
+#if __cplusplus >= 201103L
+  for(std::size_t i=0;i<nbOfTurn;i++)
+    std::swap(_sub_expr[i],_sub_expr[sz-i-1]);
+#else
+  AutoPtr<char> buf(new char[sizeof(ExprParser)]);
+  char *loc(reinterpret_cast<char *>(&_sub_expr[0])),*bufPtr(buf);
   for(std::size_t i=0;i<nbOfTurn;i++)
     {
       std::copy(loc+i*sizeof(ExprParser),loc+(i+1)*sizeof(ExprParser),bufPtr);
       std::copy(loc+(sz-i-1)*sizeof(ExprParser),loc+(sz-i)*sizeof(ExprParser),loc+i*sizeof(ExprParser));
       std::copy(bufPtr,bufPtr+sizeof(ExprParser),loc+(sz-i-1)*sizeof(ExprParser));
     }
+#endif
 }
 
 ExprParserOfEval ExprParser::convertMeTo() const
index 4d04ed707fc12f20d912d70fde0663964cf2641e..b103645cc4f775c2aab0dd14a83dd08f186037a7 100644 (file)
@@ -125,6 +125,10 @@ namespace INTERP_KERNEL
   class ExprParser
   {
   public:
+#if __cplusplus >= 201103L
+    INTERPKERNEL_EXPORT ExprParser(ExprParser&& other);
+    INTERPKERNEL_EXPORT ExprParser& operator=(ExprParser&& other);
+#endif
     INTERPKERNEL_EXPORT ExprParser(const std::string& expr, ExprParser *father=0);
     INTERPKERNEL_EXPORT ExprParser(const char *expr, int lgth, ExprParser *father=0);
     INTERPKERNEL_EXPORT ~ExprParser();