M
ma740988
I might be a little off topic but the experience level here is enough
to give me solid guidance.
So here's the code:
#ifndef FOO_TEST_H
#define FOO_TEST_H
#include <string>
#include <deque>
#include <iostream>
#include <sstream>
#include <typeinfo>
#include <cstddef>
#include <set>
#include <limits.h>
namespace foo {
class foo_test {
typedef std::deque< std::string > bucket;
bucket data;
bool bit;
void push_back ( std::string & str ) {
data.push_back( std::string() );
data.back().swap( str );
}
void mark ( void ) {
bit = true;
}
template < typename C, typename S >
struct io
{
static
foo_test & in ( foo_test & ft, S const & data )
{
std::stringstream in;
if ( in << data ) {
std::string str = in.str();
ft.push_back( str );
} else {
ft.mark();
}
return ( ft );
}
};
foo_test & operator<< ( int const & data ) {
return( io<void,int>::in( *this, data ) );
}
template < typename T >
static
void enlist ( std::string id = typeid(T).name() )
{
// stuff
}
public :
foo_test ()
: bit ( false ) {}
};
};
#endif
I'm _stuck with gcc 2.96_ for now. That said, the complaints when I
try to compile are as follows:
ccppc -g -mcpu=604 -mstrict-align -ansi -fno-builtin -I.
-IC:\Tornado2.2.1\target\h\ -DCPU
=PPC604 -DTOOL_FAMILY=gnu -DTOOL=gnu -c ..\main.cpp
In file included from ..\main.cpp:2:
...\fooTest.h: In function `static class foo::foo_test &
foo::foo_test::io<void,int>::in
(foo::foo_test &, const int &)':
...\fooTest.h:728: instantiated from here
...\fooTest.h:701: `void foo::foo_test:ush_back(string &)' is private
...\fooTest.h:719: within this context
...\fooTest.h:706: `void foo::foo_test::mark()' is private
...\fooTest.h:721: within this context
...\fooTest.h:734: sorry, not implemented: `method_call_expr' not
supported by dump_expr
make: *** [main.o] Error 0x1
Done.
------------------------
offending line (1):
return( io<void,int>::in( *this, data ) );
The question: Why would the push_back and mark methods be considered
private 'in this context'?
The answer might be it's a gcc 2.96 bug but jsut wanting to ensure it's
not something I'm doing wrong.
offending line (2):
void enlist ( std::string id = typeid(T).name() )
I dont understand the 'method_call_expr' just yet but the error
"sorry, not implemented: `method_call_expr' not supported by dump_expr"
is also a mystery.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The work around:
1) add public before 'bucket data'.
public:
bucket data;
2)
template < typename T >
static
void enlist ( std::string id )
{
id = typeid(T).name();
// stuff
}
Workaround 2 I could live with. Workaround 1 bothers me. Ideas?
Thanks in advance
to give me solid guidance.
So here's the code:
#ifndef FOO_TEST_H
#define FOO_TEST_H
#include <string>
#include <deque>
#include <iostream>
#include <sstream>
#include <typeinfo>
#include <cstddef>
#include <set>
#include <limits.h>
namespace foo {
class foo_test {
typedef std::deque< std::string > bucket;
bucket data;
bool bit;
void push_back ( std::string & str ) {
data.push_back( std::string() );
data.back().swap( str );
}
void mark ( void ) {
bit = true;
}
template < typename C, typename S >
struct io
{
static
foo_test & in ( foo_test & ft, S const & data )
{
std::stringstream in;
if ( in << data ) {
std::string str = in.str();
ft.push_back( str );
} else {
ft.mark();
}
return ( ft );
}
};
foo_test & operator<< ( int const & data ) {
return( io<void,int>::in( *this, data ) );
}
template < typename T >
static
void enlist ( std::string id = typeid(T).name() )
{
// stuff
}
public :
foo_test ()
: bit ( false ) {}
};
};
#endif
I'm _stuck with gcc 2.96_ for now. That said, the complaints when I
try to compile are as follows:
ccppc -g -mcpu=604 -mstrict-align -ansi -fno-builtin -I.
-IC:\Tornado2.2.1\target\h\ -DCPU
=PPC604 -DTOOL_FAMILY=gnu -DTOOL=gnu -c ..\main.cpp
In file included from ..\main.cpp:2:
...\fooTest.h: In function `static class foo::foo_test &
foo::foo_test::io<void,int>::in
(foo::foo_test &, const int &)':
...\fooTest.h:728: instantiated from here
...\fooTest.h:701: `void foo::foo_test:ush_back(string &)' is private
...\fooTest.h:719: within this context
...\fooTest.h:706: `void foo::foo_test::mark()' is private
...\fooTest.h:721: within this context
...\fooTest.h:734: sorry, not implemented: `method_call_expr' not
supported by dump_expr
make: *** [main.o] Error 0x1
Done.
------------------------
offending line (1):
return( io<void,int>::in( *this, data ) );
The question: Why would the push_back and mark methods be considered
private 'in this context'?
The answer might be it's a gcc 2.96 bug but jsut wanting to ensure it's
not something I'm doing wrong.
offending line (2):
void enlist ( std::string id = typeid(T).name() )
I dont understand the 'method_call_expr' just yet but the error
"sorry, not implemented: `method_call_expr' not supported by dump_expr"
is also a mystery.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The work around:
1) add public before 'bucket data'.
public:
bucket data;
2)
template < typename T >
static
void enlist ( std::string id )
{
id = typeid(T).name();
// stuff
}
Workaround 2 I could live with. Workaround 1 bothers me. Ideas?
Thanks in advance