The code will not compile.
"Gernot Frisch" <> wrote in message
news:...
>
> "Peter Olcott" <> schrieb im Newsbeitrag
> news:Rhhlf.11721$QW2.7442@dukeread08...
>> //
>> // I would like to some how avoid using the global ONE
>> // without incurring any performance penalty in speed or
>> space
>> //
>>
>> #include <vector>
>> #include <algorithm>
>
>
> class OneTwo
> {
> public:
>
>
>>
>> struct RecType {
>> int AAA;
>> int BBB;
>> int CCC;
>> bool operator<(RecType& Text){ return this->BBB <
>> Text.BBB; };
>> };
>>
>> struct OneType {
>> std::vector<RecType> Record;
>> RecType& operator[](const int N){ return Record[N]; };
>> }
>
>
> m_ONE;
>
>>
>> struct TwoType {
>> std::vector<int> Sub; // Subscripts of ONE
>> bool operator()(const int& N, const int& M);
>> void sort(){ std::sort(Sub.begin(), Sub.end(), (*this)); }
>> };
>>
>> bool TwoType:
perator()(const int& N, const int& M) {
>> return m_ONE[N] < m_ONE[M];
>> }
> };
>
>
>
#include <stdio.h>
#include <vector>
#include <algorithm>
class OneTwo {
public:
struct RecType {
int AAA;
int BBB;
int CCC;
bool operator<(RecType& Text){ return this->BBB <
Text.BBB; };
};
struct OneType {
std::vector<RecType> Record;
RecType& operator[](const int N){ return Record[N]; };
} ONE;
struct TwoType {
std::vector<int> Sub; // Subscripts of ONE
bool operator()(const int& N, const int& M)
{ return ONE[N] < ONE[M]; };
void sort(){ std::sort(Sub.begin(), Sub.end(), (*this)); };
};
//std::vector<TwoType> StackTwoType;
};
void main() {
}
t.cpp
t.cpp(24) : error C2327: 'OneTwo::ONE' : member from enclosing
class is not a type name, static, or enumerator
t.cpp(24) : error C2065: 'ONE' : undeclared identifier
t.cpp(24) : error C2109: subscript requires array or pointer type
t.cpp(24) : error C2327: 'OneTwo::ONE' : member from enclosing
class is not a type name, static, or enumerator
t.cpp(24) : error C2109: subscript requires array or pointer type
t.cpp(35) : error C2143: syntax error : missing ';' before '.'
t.cpp(35) : error C2501: 't' : missing storage-class or type
specifiers
t.cpp(35) : error C2143: syntax error : missing ';' before '.'