如何在AIX 6.1 w / o C ++ 11上编译boost 1.56 multiprecision

时间:2016-03-08 22:39:46

标签: c++ c++11 boost aix

我想在AIX 6.1中编译multiprecision boost lib。 编译器不支持最新的C ++,因此我定义了一些宏来使用旧语法。

#include <boost/optional.hpp>

#define __IBMCPP_TR1__ 1
#define BOOST_NO_CXX11_RVALUE_REFERENCES 1
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES 1
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS 1
#define BOOST_NO_CXX11_CONSTEXPR 1
#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS 1
#define BOOST_NO_CXX11_HDR_ARRAY 1

#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

int* foo(double *xarr) {
    using boost::multiprecision::cpp_int;

    cpp_int i, j, k;
    j = i + k;

    using boost::multiprecision::cpp_dec_float;
    typedef boost::multiprecision::number<cpp_dec_float<53> > 
        cpp_bin_float_53;

    cpp_bin_float_53 a, b, c;
    a = b + c;
    return NULL;
}

最终我收到了以下错误。它主要是抱怨它在std :: reverse_iterator之间找不到!=的定义。这是否意味着我应该通过使用一些宏来关闭更多的C ++语法?谢谢,

"../../../../../../include/boost/integer_traits.hpp", line 83.56: 1540-0724 (W) The non-type template argument "-1" of type "T" has wrapped.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.23: 1540-0218 (S) The call does not match any parameter list for "operator!=".
"../../../../../../include/boost/multiprecision/detail/number_compare.hpp", line 145.13: 1540-1283 (I) "template <class Backend, expression_template_option ExpressionTemplates> boost::multiprecision::operator!=(const number<Backend,ExpressionTemplates> &, const number<Backend,ExpressionTemplates> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const number<Backend,ExpressionTemplates> &" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"../../../../../../include/boost/multiprecision/detail/number_compare.hpp", line 152.4: 1540-1283 (I) "template <class Backend, expression_template_option ExpressionTemplates, class Arithmetic> boost::multiprecision::operator!=(const number<Backend,ExpressionTemplates> &, const Arithmetic &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const number<Backend,ExpressionTemplates> &" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"../../../../../../include/boost/multiprecision/detail/number_compare.hpp", line 159.4: 1540-1283 (I) "template <class Arithmetic, class Backend, expression_template_option ExpressionTemplates> boost::multiprecision::operator!=(const Arithmetic &, const number<Backend,ExpressionTemplates> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.36: 1540-0288 (I) The function template parameter of type "const number<Backend,ExpressionTemplates> &" cannot be initialized with an argument of type "std::reverse_iterator<std::_Ptrit<char,long,char *,char &,char *,char &> >".
"../../../../../../include/boost/multiprecision/detail/number_compare.hpp", line 166.4: 1540-1283 (I) "template <class Arithmetic, class Tag, class A1, class A2, class A3, class A4> boost::multiprecision::operator!=(const Arithmetic &, const expression<Tag,A1,A2,A3,A4> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.36: 1540-0288 (I) The function template parameter of type "const expression<Tag,A1,A2,A3,A4> &" cannot be initialized with an argument of type "std::reverse_iterator<std::_Ptrit<char,long,char *,char &,char *,char &> >".
"../../../../../../include/boost/multiprecision/detail/number_compare.hpp", line 175.4: 1540-1283 (I) "template <class Tag, class A1, class A2, class A3, class A4, class Arithmetic> boost::multiprecision::operator!=(const expression<Tag,A1,A2,A3,A4> &, const Arithmetic &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const expression<Tag,A1,A2,A3,A4> &" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"../../../../../../include/boost/multiprecision/detail/number_compare.hpp", line 184.4: 1540-1283 (I) "template <class Tag, class A1, class A2, class A3, class A4, class Tagb, class A1b, class A2b, class A3b, class A4b> boost::multiprecision::operator!=(const expression<Tag,A1,A2,A3,A4> &, const expression<Tagb,A1b,A2b,A3b,A4b> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const expression<Tag,A1,A2,A3,A4> &" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"/usr/vacpp/include/utility", line 90.14: 1540-1283 (I) "template <class _T1, class _T2> std::operator!=(const pair<_T1,_T2> &, const pair<_T1,_T2> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const pair<_T1,_T2> &" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"/usr/vacpp/include/xutility", line 321.14: 1540-1283 (I) "template <class _Ty, class _D, class _Pt, class _Rt, class _Pt2, class _Rt2> std::operator!=(const _Ptrit<_Ty,_D,_Pt,_Rt,_Pt,_Rt> &, const _Ptrit<_Ty,_D,_Pt2,_Rt2,_Pt,_Rt> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const _Ptrit<_Ty,_D,_Pt,_Rt,_Pt,_Rt> &" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"/usr/vacpp/include/xutility", line 468.14: 1540-1283 (I) "template <class _RI> std::operator!=(const reverse_iterator<_RI> &, const reverse_iterator<_RI> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.23: 1540-0290 (I) The function template parameter "_RI" has been found to have two values: "std::_Ptrit<char,long,const char *,const char &,char *,char &>" and "std::_Ptrit<char,long,char *,char &,char *,char &>".
"/usr/vacpp/include/xutility", line 630.14: 1540-1283 (I) "template <class _E, class _Tr> std::operator!=(const istreambuf_iterator<_E,_Tr> &, const istreambuf_iterator<_E,_Tr> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const istreambuf_iterator<_E,_Tr> &" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"/usr/vacpp/include/iterator", line 197.14: 1540-1283 (I) "template <class _Ty, class _E, class _Tr, class _Dist> std::operator!=(const istream_iterator<_Ty,_E,_Tr,_Dist> &, const istream_iterator<_Ty,_E,_Tr,_Dist> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const istream_iterator<_Ty,_E,_Tr,_Dist> &" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"/usr/vacpp/include/xmemory", line 433.14: 1540-1283 (I) "template <class _Ty, class _U> std::operator!=(const allocator<_Ty> &, const allocator<_U> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const allocator<_Ty> &" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"/usr/vacpp/include/string", line 120.14: 1540-1283 (I) "template <class _E, class _Tr, class _A> std::operator!=(const basic_string<_E,_Tr,_A> &, const basic_string<_E,_Tr,_A> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const basic_string<_E,_Tr,_A> &" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"/usr/vacpp/include/string", line 124.14: 1540-1283 (I) "template <class _E, class _Tr, class _A> std::operator!=(const _E *, const basic_string<_E,_Tr,_A> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const _E *" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"/usr/vacpp/include/string", line 128.14: 1540-1283 (I) "template <class _E, class _Tr, class _A> std::operator!=(const basic_string<_E,_Tr,_A> &, const _E *)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const basic_string<_E,_Tr,_A> &" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"/usr/vacpp/include/vector", line 807.14: 1540-1283 (I) "template <class _Ty, class _A> std::operator!=(const vector<_Ty,_A> &, const vector<_Ty,_A> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const vector<_Ty,_A> &" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"/usr/vacpp/include/xcomplex", line 261.14: 1540-1283 (I) "template <class _Ty> std::operator!=(const complex<_Ty> &, const complex<_Ty> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const complex<_Ty> &" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"/usr/vacpp/include/xcomplex", line 265.14: 1540-1283 (I) "template <class _Ty> std::operator!=(const complex<_Ty> &, const _Ty &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.10: 1540-0288 (I) The function template parameter of type "const complex<_Ty> &" cannot be initialized with an argument of type "const std::reverse_iterator<std::_Ptrit<char,long,const char *,const char &,char *,char &> >".
"/usr/vacpp/include/xcomplex", line 269.14: 1540-1283 (I) "template <class _Ty> std::operator!=(const _Ty &, const complex<_Ty> &)" is not a viable candidate.
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1966.36: 1540-0288 (I) The function template parameter of type "const complex<_Ty> &" cannot be initialized with an argument of type "std::reverse_iterator<std::_Ptrit<char,long,char *,char &,char *,char &> >".
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 1876.6: 1540-0700 (I) The previous message was produced while processing "boost::multiprecision::backends::cpp_dec_float<53,int,void>::rd_string(const char * const)".
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 414.7: 1540-0700 (I) The previous message was produced while processing "boost::multiprecision::backends::cpp_dec_float<53,int,void>::operator=(const char *)".
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 182.16: 1540-0700 (I) The previous message was produced while processing "boost::multiprecision::backends::cpp_dec_float<53,int,void>::cpp_dec_float(const char *)".
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 2605.8: 1540-0700 (I) The previous message was produced while processing "boost::multiprecision::backends::cpp_dec_float<53,int,void>::pow2(const long long)".
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 159.14: 1540-0700 (I) The previous message was produced while processing "boost::multiprecision::backends::cpp_dec_float<53,int,void>::initializer::initializer()".
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 601.72: 1540-0700 (I) The previous message was produced while processing "boost::multiprecision::backends::cpp_dec_float<53,int,void>::init".
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 361.32: 1540-0700 (I) The previous message was produced while processing "boost::multiprecision::backends::cpp_dec_float<53,int,void>::eps()".
"../../../../../../include/boost/multiprecision/cpp_dec_float.hpp", line 52.7: 1540-0700 (I) The previous message was produced while processing "class boost::multiprecision::backends::cpp_dec_float<53,int,void>".
"../../../../../../include/boost/multiprecision/number.hpp", line 38.7: 1540-0700 (I) The previous message was produced while processing "class boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<53,int,void>,0>".
"myTest.cc", line 14.6: 1540-0700 (I) The previous message was produced while processing "averageT(double *)".

&#39;

1 个答案:

答案 0 :(得分:0)

经过更多调查,似乎xlC无法编译reverse_iterator。例如,以上代码不是由AIX上的xlC编译的,原因与上面相同......

#include <string>
#include <iterator>
#include <algorithm>

bool isNonZero(const char c) {
  return c != '0';
}

void test()   {
  std::string str;
  const std::string::const_reverse_iterator rit_non_zero = std::find_if(str.rbegin(), str.rend(), isNonZero);

  if( rit_non_zero != str.rbegin())
    {
      const std::string::size_type ofs = str.length() - std::distance<std::string::const_reverse_iterator>(str.rbegin(), rit_non_zero);
      str.erase(str.begin() + ofs, str.end());
    }
}
相关问题