operators and namespaces

  • Thread starter =?ISO-8859-1?Q?Alexander_B=FCrger?=
  • Start date
?

=?ISO-8859-1?Q?Alexander_B=FCrger?=

Hi,

I have a question about operators. I have something similar to the
following code:

//================
// file a.h
class A { ... };

// file op.h
namespace s {
template<typename T>
A& operator<<( A& a, T const& t ) { ...; return a; }
}

// file prog.cxx
void f() {
A a;
int i=0;
a << i;
}
//================

How can I specifiy the namespace for the operator? I tried

a << s::eek:perator<< i;

but my compiler does not like it and I actually have no idea how it
should be.

Best wishes,

Alexander
 
V

Victor Bazarov

Alexander said:
I have a question about operators. I have something similar to the
following code:

//================
// file a.h
class A { ... };

// file op.h
namespace s {
template<typename T>
A& operator<<( A& a, T const& t ) { ...; return a; }
}

// file prog.cxx
void f() {
A a;
int i=0;
a << i;
}
//================

How can I specifiy the namespace for the operator? I tried

a << s::eek:perator<< i;

but my compiler does not like it and I actually have no idea how it
should be.

s::eek:perator <<(a, i);

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top