Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 19, 2005 Problem with MFCSTL array_veneer | ||||
---|---|---|---|---|
| ||||
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 |
July 19, 2005 Re: Problem with MFCSTL array_veneer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Gabor Fischer | 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 > |
July 20, 2005 Re: Problem with MFCSTL array_veneer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | 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 |
July 20, 2005 MFCSTL Test Project | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Attachments: | Hi! Here comes my test project: 4196 So Long... Gabor |
July 21, 2005 Re: Problem with MFCSTL array_veneer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Gabor Fischer | 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 > |
July 26, 2005 Re: Problem with MFCSTL array_veneer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | 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 >> > > |
August 03, 2005 Re: Problem with MFCSTL array_veneer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | 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 >> > > |
December 20, 2005 Re: Problem with MFCSTL array_veneer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Gabor Fischer | 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 > |
Copyright © 1999-2021 by the D Language Foundation