Angus Leeming <[EMAIL PROTECTED]> writes:

| #include <iostream>
| #include <string>
| #include <algorithm>
>
| using std::string;
>
| class Foo {
| public:
|         class Functor {
|         public:
|                 Functor(char cin) : c(cin) {}
|                 bool operator()(char comp) { return c == comp; }
|         private:
|                 char c;
|         };
>
|         void do_stuff() {
|                 string const me("Angus");
|                 char const c = 'n';
|                 string::const_iterator begin = me.begin();
|                 string::const_iterator end   = me.end();
|                 string::const_iterator it =
|                         std::find_if(begin, end, Functor(c));
|                 if (it == end) {
|                         std::cout << c << " not found" << std::endl;
|                 } else {
|                         std::cout << c << " found at pos "
|                                   << it - begin << std::endl;
|                 }
|         }
| };
>
| int main() {
|         Foo foo;
|         foo.do_stuff();
|         return 0;
| }
>
| aleem@pneumon:aleem-> ./trial
| n found at pos 1

Right now I feel pretty clueless...

all my variants with this work

outside foo
outside foo inside anon namespace
inside foo...

but there is one variant that is not allowed...


-- 
        Lgb

Reply via email to