Hi,
I have a template class that looks like:
template <class T>
class Update
{
friend otl_stream& operator<< (otl_stream&, const shared_ptr<type name T::row>&);
friend ostream& operator<< (ostream&, const shared_ptr<type name T::row>&);
friend struct write_row2datab ase;
public:
typedef shared_ptr<type name T::row> ROW;
typedef typename vector<ROW>::it erator iter;
typedef typename vector<ROW>::va lue_type val;
....
struct display_row {
void operator()(val& aVal) {
cout << aVal;
}
};
struct write_row2datab ase {
void operator()(val& aVal) {
// (Update<T>).i << aVal;
// !!!!! the problem !!!!!
// i is (private) member of template class, how to address ?
}
....
bool flush(string& error)
{
for_each(v.begi n(), v.end(), display_row()); //works
for_each(v.begi n(), v.end(), write_row2datab ase());
}
private:
...
vector<ROW> v;
otl_nocommit_st ream i;
...
};
My question:
How can I write to i inside write_row2datab ase ,
what is the correct syntax?
I declared
friend struct write_row2datab ase;
and there exist a operator overloading for "otl_stream<<th eROW".
Looking wishful forward to a reply,
Thomas
I have a template class that looks like:
template <class T>
class Update
{
friend otl_stream& operator<< (otl_stream&, const shared_ptr<type name T::row>&);
friend ostream& operator<< (ostream&, const shared_ptr<type name T::row>&);
friend struct write_row2datab ase;
public:
typedef shared_ptr<type name T::row> ROW;
typedef typename vector<ROW>::it erator iter;
typedef typename vector<ROW>::va lue_type val;
....
struct display_row {
void operator()(val& aVal) {
cout << aVal;
}
};
struct write_row2datab ase {
void operator()(val& aVal) {
// (Update<T>).i << aVal;
// !!!!! the problem !!!!!
// i is (private) member of template class, how to address ?
}
....
bool flush(string& error)
{
for_each(v.begi n(), v.end(), display_row()); //works
for_each(v.begi n(), v.end(), write_row2datab ase());
}
private:
...
vector<ROW> v;
otl_nocommit_st ream i;
...
};
My question:
How can I write to i inside write_row2datab ase ,
what is the correct syntax?
I declared
friend struct write_row2datab ase;
and there exist a operator overloading for "otl_stream<<th eROW".
Looking wishful forward to a reply,
Thomas
Comment