a valarray error with mingw

H

holmescn

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

I compiled it with mingw 3.4.5 .but i have got an error said
slice_array 's constructor is private.
yes i know it .but valarray is his friend class.
and the code is works well in vc8
why is this happen?
is somebody meet this problem?how to solve it?
Thx!
 
P

Prashanth

It is not valarray which is going to call the constructor of
slice_array, but the code generated by the compiler. And it cannot
call a private member from outside the class. So the solution is to
make the constructor public.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top