a valarray error with mingw

Developers
2007-04-15
2013-05-13
  • HolmesConan
    HolmesConan
    2007-04-15

    I wrote the code below:
    #include <valarray>
    using namespace std;
    int main()
    {
       valarray<double> v0(2,10);
       valarray<double> v1 = v0[slice(0,1,5)];
       return 0;
    }

    I got an error :
    error: `stlp_std::slice_array<_Tp>::slice_array(const stlp_std::slice_array<_Tp>&) [with _Tp = double]' is private

    but the code works well in vc8.
    why is that happen?

    I know it is private, but valarray is his friend.
    anybody who could explain it for me?
    Thx!!

     
    • I will add it to unit tests and keep you inform of the result.

       
    • HolmesConan
      HolmesConan
      2007-04-17

      I make a simple fix like this at stl/_valarray.h line: 1204
      I add this:

      #if defined(__MINGW32__)
      public:
      #else
      private:
      #endif
        slice_array(const slice_array&);
      private:                        // Disable assignment and default constructor
        slice_array();

        slice_array& operator=(const slice_array&);

      I don't know whether this is the common mistake in gcc.
      I have test it.and it works well.

       
    • I saw that you also post the problem to comp.lang.c++, here is the link:

      http://groups.google.de/group/comp.lang.c++.moderated/browse_thread/thread/19fd5350332f65dd/79ad9487ae8c713c

      I have going to apply the same modification as the one in the native MinGW lib to STLport to avoid the Standard defect.

      Bests