slice_array problem in vs2005

H

holmescn

Hi-
Anyone here used vs2005?So I appreciate your help.
I used stlport 5.0. When I complied the code below,an error occured:

#include<valarray>

using namespace std;

main()

{
valarray<int> val(10);

slice_array<int>& v0=val[slice(0,5,2)]; ///aaa
const slice_array<int>& v1=val[slice(0,5,2)]///bbb

}

there aaa and bbb both occured an compiling error:
error C2248: 'stlp_std::slice_array<_Tp>::slice_array' : cannot access
private member declared in class 'stlp_std::slice_array<_Tp>'
I know that slice_array can't be constructed,but why a reference is
also error?

aaa is an example in Stroustrup TC++PL 3rd special edition
bbb is some help i found in the past information in 2001,but they used
gcc.

finally i found some solution in MSDN. They used val[slice] directly.I
have tryed it .And it works well.
But i still want to know why this problem happened.

Look forward to your answers.
Thx
 

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,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top