www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - Problem with MFCSTL array_veneer

reply Gabor.Fischer systecs.com (Gabor Fischer) writes:
Hi!


I have just begun to test the array_veneer class in MFCSTL. I use STLSoft  
1.8.3 with Visual C++ 7.0.

I encountered problems when writing simple test programs. First I wanted  
to apply std::sort to array_veneer:



struct MyTrait
{
    typedef int         value_type;
    typedef int         arg_type;
};

.
.
.


mfcstl::array_veneer<CArray<int>, MyTrait> av;
std::sort(av.begin(), av.end());



This fails to compile (six errors).

Ok, next test: Try to use std::back_inserter with array_veneer:


mfcstl::array_veneer<CArray<int>, MyTrait> av1;
mfcstl::array_veneer<CArray<int>, MyTrait> av2;
std::copy(av1.begin(), av1.end(), std::back_inserter(av2));


Fails to compile too (the compiler is complaining that reference is not a  
member of array_veneer)

BTW, by simply creating an array_veneer like above (and nothing else), I  
get two warnings saying that the copy constructor and the copy assignment  
operator could not be created. Is that normal?

And, while I am at it: Why does the array_adaptor class only have a  
const_iterator, not an iterator, and no push_back?




So Long...

Gabor
Jul 19 2005
next sibling parent reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
First, let me say that MFCSTL has had very little input over the 
last couple of years, as is probably evident by the code.

If you can post a sample file showing what you want to achieve, I'll 
be able to comment on whether it's possible and, if it is, I would 
think a fix will be forthcoming. ;-)

Cheers

Matthew

P.S. I'm thinking of renaming several 'veneer' classes, so changes 
to meet your requirements might tie in quite nicely.

"Gabor Fischer" <Gabor.Fischer systecs.com> wrote in message 
news:9aBupAFKQNB systecs.com...
 Hi!


 I have just begun to test the array_veneer class in MFCSTL. I use 
 STLSoft
 1.8.3 with Visual C++ 7.0.

 I encountered problems when writing simple test programs. First I 
 wanted
 to apply std::sort to array_veneer:



 struct MyTrait
 {
    typedef int         value_type;
    typedef int         arg_type;
 };

 .
 .
 .


 mfcstl::array_veneer<CArray<int>, MyTrait> av;
 std::sort(av.begin(), av.end());



 This fails to compile (six errors).

 Ok, next test: Try to use std::back_inserter with array_veneer:


 mfcstl::array_veneer<CArray<int>, MyTrait> av1;
 mfcstl::array_veneer<CArray<int>, MyTrait> av2;
 std::copy(av1.begin(), av1.end(), std::back_inserter(av2));


 Fails to compile too (the compiler is complaining that reference 
 is not a
 member of array_veneer)

 BTW, by simply creating an array_veneer like above (and nothing 
 else), I
 get two warnings saying that the copy constructor and the copy 
 assignment
 operator could not be created. Is that normal?

 And, while I am at it: Why does the array_adaptor class only have 
 a
 const_iterator, not an iterator, and no push_back?




 So Long...

 Gabor
 
Jul 19 2005
next sibling parent reply Gabor.Fischer systecs.com (Gabor Fischer) writes:
Hi Matthew!


 If you can post a sample file showing what you want to achieve, I'll
 be able to comment on whether it's possible and, if it is, I would
 think a fix will be forthcoming. ;-)
Well, what Im'm trying to achieve is basically what I have posted: Apply STL algorithms to MFC CArray, with array_veneer and array_adaptor. ;-) We have a third party library here that takes and returns CArrays (and its specialisations). Right now, I am copying the CArrays to vectors and back, whenever I want to use STL algorithms, I was hoping that with MFCSTL I could skip that and could write code like CObArray Array = SomeLibraryFunc( ... ); mfcstl::array_adaptor<CObArray> Adapt; std::sort(Adapt.begin(), Adapt.end(), MyPred); Or like mfcstl::array_veneer<CObArray> Ven; std::copy(SomeSource.begin(), SomeSource.end(), std::back_inserter(Ven)); SomeOtherLibraryFunc(Ven); // Takes CObArray as argument The first one fails because array_adaptor only supports const_iterator, not iterator. But std::sort also fails with array_veneer, although it should work, since array_veneer supports iterator, and it provides random access iterators. And std::back_inserter fails on both array_adaptor and array_veneer because array_adaptor does not have push_back and array_veneer does not have a reference typedef (probably const_reference would also be needed). For your convenience, I will post a small test project which illustrates the problems. So Long... Gabor
Jul 20 2005
parent reply "Matthew" <admin.hat stlsoft.dot.org> writes:
Got it

FYI: I'm writing my next book, Extended STL, at the moment, and in a few days
I'll be working on the material about 
adapting non-STL collections, so this'll be ideal material. As such, I think I
may have some good news for you next 
week.

Cheers

Matthew

"Gabor Fischer" <Gabor.Fischer systecs.com> wrote in message
news:9aFuyXOpQNB systecs.com...
 Hi Matthew!


 If you can post a sample file showing what you want to achieve, I'll
 be able to comment on whether it's possible and, if it is, I would
 think a fix will be forthcoming. ;-)
Well, what Im'm trying to achieve is basically what I have posted: Apply STL algorithms to MFC CArray, with array_veneer and array_adaptor. ;-) We have a third party library here that takes and returns CArrays (and its specialisations). Right now, I am copying the CArrays to vectors and back, whenever I want to use STL algorithms, I was hoping that with MFCSTL I could skip that and could write code like CObArray Array = SomeLibraryFunc( ... ); mfcstl::array_adaptor<CObArray> Adapt; std::sort(Adapt.begin(), Adapt.end(), MyPred); Or like mfcstl::array_veneer<CObArray> Ven; std::copy(SomeSource.begin(), SomeSource.end(), std::back_inserter(Ven)); SomeOtherLibraryFunc(Ven); // Takes CObArray as argument The first one fails because array_adaptor only supports const_iterator, not iterator. But std::sort also fails with array_veneer, although it should work, since array_veneer supports iterator, and it provides random access iterators. And std::back_inserter fails on both array_adaptor and array_veneer because array_adaptor does not have push_back and array_veneer does not have a reference typedef (probably const_reference would also be needed). For your convenience, I will post a small test project which illustrates the problems. So Long... Gabor
Jul 21 2005
next sibling parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
I'm going to release STLSoft 1.8.4 in the next day or so, and this 
will _not_ be in there, but I will look at it as soon as that 
release is done.

"Matthew" <admin.hat stlsoft.dot.org> wrote in message 
news:dbnoar$1sa3$1 digitaldaemon.com...
 Got it

 FYI: I'm writing my next book, Extended STL, at the moment, and in 
 a few days I'll be working on the material about adapting non-STL 
 collections, so this'll be ideal material. As such, I think I may 
 have some good news for you next week.

 Cheers

 Matthew

 "Gabor Fischer" <Gabor.Fischer systecs.com> wrote in message 
 news:9aFuyXOpQNB systecs.com...
 Hi Matthew!


 If you can post a sample file showing what you want to achieve, 
 I'll
 be able to comment on whether it's possible and, if it is, I 
 would
 think a fix will be forthcoming. ;-)
Well, what Im'm trying to achieve is basically what I have posted: Apply STL algorithms to MFC CArray, with array_veneer and array_adaptor. ;-) We have a third party library here that takes and returns CArrays (and its specialisations). Right now, I am copying the CArrays to vectors and back, whenever I want to use STL algorithms, I was hoping that with MFCSTL I could skip that and could write code like CObArray Array = SomeLibraryFunc( ... ); mfcstl::array_adaptor<CObArray> Adapt; std::sort(Adapt.begin(), Adapt.end(), MyPred); Or like mfcstl::array_veneer<CObArray> Ven; std::copy(SomeSource.begin(), SomeSource.end(), std::back_inserter(Ven)); SomeOtherLibraryFunc(Ven); // Takes CObArray as argument The first one fails because array_adaptor only supports const_iterator, not iterator. But std::sort also fails with array_veneer, although it should work, since array_veneer supports iterator, and it provides random access iterators. And std::back_inserter fails on both array_adaptor and array_veneer because array_adaptor does not have push_back and array_veneer does not have a reference typedef (probably const_reference would also be needed). For your convenience, I will post a small test project which illustrates the problems. So Long... Gabor
Jul 25 2005
prev sibling parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
Gabor

I'm working on this right now. I did a fair amount yesterday, and 
expect to having something testable in the next 48hrs

Cheers

Matthew

"Matthew" <admin.hat stlsoft.dot.org> wrote in message 
news:dbnoar$1sa3$1 digitaldaemon.com...
 Got it

 FYI: I'm writing my next book, Extended STL, at the moment, and in 
 a few days I'll be working on the material about adapting non-STL 
 collections, so this'll be ideal material. As such, I think I may 
 have some good news for you next week.

 Cheers

 Matthew

 "Gabor Fischer" <Gabor.Fischer systecs.com> wrote in message 
 news:9aFuyXOpQNB systecs.com...
 Hi Matthew!


 If you can post a sample file showing what you want to achieve, 
 I'll
 be able to comment on whether it's possible and, if it is, I 
 would
 think a fix will be forthcoming. ;-)
Well, what Im'm trying to achieve is basically what I have posted: Apply STL algorithms to MFC CArray, with array_veneer and array_adaptor. ;-) We have a third party library here that takes and returns CArrays (and its specialisations). Right now, I am copying the CArrays to vectors and back, whenever I want to use STL algorithms, I was hoping that with MFCSTL I could skip that and could write code like CObArray Array = SomeLibraryFunc( ... ); mfcstl::array_adaptor<CObArray> Adapt; std::sort(Adapt.begin(), Adapt.end(), MyPred); Or like mfcstl::array_veneer<CObArray> Ven; std::copy(SomeSource.begin(), SomeSource.end(), std::back_inserter(Ven)); SomeOtherLibraryFunc(Ven); // Takes CObArray as argument The first one fails because array_adaptor only supports const_iterator, not iterator. But std::sort also fails with array_veneer, although it should work, since array_veneer supports iterator, and it provides random access iterators. And std::back_inserter fails on both array_adaptor and array_veneer because array_adaptor does not have push_back and array_veneer does not have a reference typedef (probably const_reference would also be needed). For your convenience, I will post a small test project which illustrates the problems. So Long... Gabor
Aug 03 2005
prev sibling parent Gabor.Fischer systecs.com (Gabor Fischer) writes:
Hi!

Here comes my test project:


begin 644 MfcStlTest.ZIP


MG<9&-X4Q!?7>Y]W[?-X7[Y2+."T8 IUK%B6OYQM[.#A],RZ2^%&G3YCK`Y`P
M3""<77]>WM"2%EP "'R!TA3>7:_(C(+Q9#AH!)IPF6N%T?:J:8S2M51<;UI6


M4`>2I'V"RY+0NKB`KX)K6'P)C$\"SLDT>25EQNKX_ WJA61%BK>18"DZ=\OY
MW#T
M<6N(&AD#Y6!AFF,5! Y7D7.Q/F8^[D2H7>E?2-4%WV^VH7M[+E5/X$2J$*-X
M,^X1E.V[D><H_A%RD:/2)>G1B0IOAA%&/C2%`97R*.;HWO29!+.55&QJ3%<0
M[48-;EJ=9T6^"0VS\][MA4;]T,=^Z$,_Y+FM_.KQM)?"9(*L2L$OQ[1VJLOJ

MU]?Y/X?F7V;`:RG(]KV26\')R^NN32`SWE>;1EF\)H?751:K/)(LA;I0XNT`
MJHZJWU!+`P04``(`"``C ?0R"%<1O]T```!``0``" ```'-T9&%F>"YC<'!=

M.]ZQ;2&+,^.UL3'"%CX*>B]X54R0GL$1`I>TS%X,.Y/<RSM;7QQF0.(3L4.I
MJ[8%V(^V%S] EB;:"2 +.$SP'9(-YTB>,`G"#HVBJ^)Q.YR^`%FFNY?ETC_%

M_258RY%2AN[U[;/9P6)0V`$K3>:5,K(VZ.9G`";-H,+9!++V;NKJ%U!+`P04

MR,]+3N7EXN52SLQ+SBE-2550*DHMSB\M2D[5RU#BY0

M7\":'*2:B%'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S_[%,. ]Z&*3!L* )"]:/Q\87_7=
ME<]2+>.NR2\O_6[-(1.?JOW)8=3'7$S=QSFB7M4?S\P)K,KJ&UMLEX(8A";\

MDHD<M+MS'0W\X9YR3&2J\[+U[C&G?<H*#M$UY?H6U2FD,E,4*H=GM_HMA`&H
M>T81AG*UMK67WV#F0\+E.JY&U*Y7J.!Y$IH"!^S=LS1D=9XEHHK.#Z
MP1%)_4Q0(^^M$B+L%56:Q4SW$;DPD<RDDU9 _>\PV=56) NT0FZ98$;XKQ+%
M4[(JD^L) A13)I>SDH'E4_,?Q6FG_SU.:Q[":5OXR8(,IC`'A0\< X)J-[SQ
MR+^8]26/\C:T_B>V[T5L3T3%(\S`Q+Z]<(CG>X/O/F3`>80H8""*-A4J'8<F
MB4M=NEJY$<Q=&7&7X;=,[MR0:)>D<<E-QKT]HX"//W8/$Z*7FZ_2$_15:M>-
M^A[+5$=DOMJP*E2_YNQM3T=KL5G(/:RYBQT>`&JC_OH:V1M8]3KYKJ%M5#H?
M8E-W8*!PNA4$2VQXXBX1!,O890(Q(. !?5\>TO7R,!UF9;&RQ69/UE-S,YG]

MCN\EER'AQ;C^.&G7M_Q\1/D74$L!`A0`%``"`` `<8/T,N)0Y:PA` ``LP4`
M``X```````````` `````````$UF8U-T;%1E<W0N8W!P4$L!`A0`%``"`` `
M(X'T, A7$;_=````0`$```H```````````` ````30(``'-T9&%F>"YC<'!0


M``````` ````I0,``%)E<V]U<F-E+FA02P$"%``4``(`"``T ?0RCVUIUAT"




M````````````(````$`*``!-9F-3=&Q497-T+G9C<')O:E!+!08`````"``(

`
end
4196



So Long...

Gabor
Jul 20 2005
prev sibling parent "Matthew" <matthew stlsoft.com> writes:
Check out the CArray_cadaptor and CArray_iadaptor adaptor classes released
in the
1.9.1 beta.

Sorry for the delay. ;-)

Cheers

Matthew


"Gabor Fischer" <Gabor.Fischer systecs.com> wrote in message
news:9aBupAFKQNB systecs.com...
 Hi!


 I have just begun to test the array_veneer class in MFCSTL. I use STLSoft
 1.8.3 with Visual C++ 7.0.

 I encountered problems when writing simple test programs. First I wanted
 to apply std::sort to array_veneer:



 struct MyTrait
 {
    typedef int         value_type;
    typedef int         arg_type;
 };

 .
 .
 .


 mfcstl::array_veneer<CArray<int>, MyTrait> av;
 std::sort(av.begin(), av.end());



 This fails to compile (six errors).

 Ok, next test: Try to use std::back_inserter with array_veneer:


 mfcstl::array_veneer<CArray<int>, MyTrait> av1;
 mfcstl::array_veneer<CArray<int>, MyTrait> av2;
 std::copy(av1.begin(), av1.end(), std::back_inserter(av2));


 Fails to compile too (the compiler is complaining that reference is not a
 member of array_veneer)

 BTW, by simply creating an array_veneer like above (and nothing else), I
 get two warnings saying that the copy constructor and the copy assignment
 operator could not be created. Is that normal?

 And, while I am at it: Why does the array_adaptor class only have a
 const_iterator, not an iterator, and no push_back?




 So Long...

 Gabor
Dec 20 2005