Re: Re: Problem with ostringstream and Daixtrose
"John Fletcher" <[email protected]> Thu, 12 Jan 2006 09:58:10 -0000
| Newsgroups | gmane.comp.lib.daixtrose.help |
|---|---|
| Message-ID | <43C62832.31861.211F9D@localhost> |
Marcus
I have evolved a workaround in which which I put
{ } around the code which needs Daixt::DefaultOps
Then I avoid any operator << to the ostringstream object inside the
{ } and all is well. The object can be passed as an argument inside
the { } code.
Thanks
John
To: [email protected]
From: Markus
Werle <[email protected]>
Subject: [Daixtrose-help]
Re: Problem with ostringstream and Daixtrose
Date sent: Wed,
11 Jan 2006 21:11:07 +0100
> Hi!
>
> Yes, I dislike the way C++ name lookup is unable to be directed
> to the right path here.
> The reason for the error is that
> using namespace Daixt::DefaultOps;
> includes operator<< which is then chosen instead the correct one. I
> should have investigated why this happens even for the case you also
> say
> using namespace std;
>
> Seems like my operator is a better match - which i did not expect.
>
> Unfortuantely Compilers reject
> using std::operator<<;
> and also I would appreciate C++ to have keyword "not"
> not using Daixt::DefaultOps::operator<<
>
> The only way you may get around this problem is by
> using using declaratives (sic!) a la
>
> using Daixt::DefaultOps::operator+;
> using Daixt::DefaultOps::operator-;
> using Daixt::DefaultOps::operator*;
> using Daixt::DefaultOps::operator/;
> using Daixt::DefaultOps::operator==;
> using Daixt::DefaultOps::operator%=;
> using Daixt::DefaultOps::Pow;
> using Daixt::DefaultOps::RationalPow;
>
> instead of using the whole namespace at once.
> Things will get much better in the next evolution step
> of my library, but this issue really bites.
>
> Code snippet that compiles with intel-9 but still fails with
> gcc-3.3.4 which has some trouble with the using stuff, so you
> probably have to take a newer gcc - I am unsure here.
>
> #include "daixtrose/Daixt.h"
> #include "daixtrose/DefaultOps.h"
>
> #include <iostream>
> #include <sstream>
>
> int main()
> {
> using namespace std;
> using Daixt::DefaultOps::operator+;
> //using namespace Daixt::DefaultOps;
>
> std::ostringstream out;
>
>
> //std::cout << "Test of sstream problem " << std::endl;
> out << "Test of sstream problem " << std::endl;
> std::cout << out.str();
> return 0;
> }
>
>
>
> Btw.: I like to see someone else use my lib.
> The key issues become clear in a way I could not
> achieve myself. Thank you for beta-using!
>
> best regards,
>
> Markus
>
--
Dr John P. Fletcher Tel: (44) 121 204 3389 (direct line)
Chemical Engineering and Applied Chemistry (CEAC),
School of Engineering and Applied Science (SEAS),
Aston University, Aston Triangle, BIRMINGHAM B4 7ET U.K.
CEAC Web site http://www.ceac.aston.ac.uk/
FAX: (44) 121 204 3679
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click