How to unset iomanip manipulators? Hi All, Assume I put the following in the code: cout << setw(pos) << setfill('*') << " "; cout << setiosflags(ios::left) << setw(len) << s << " : " << str << endl; How can I return things back to 'normal'? How should I unset width, left alignment, padding character, etc? Thank you, Alona -- [... 8 Dec 2009 19:45
pros and cons of returning const ref to string instead of string by value > Frankly, what you describe seems like a perfect fit for using shared_ptr Have your member be a shared_ptr<std::string>. And return shared_ptr<const std::string> from your getter function. shared_ptr adds itself a visible overhead, and may even be slower than returning string by value if the string has an... 4 Dec 2009 11:44
pros and cons of returning const ref to string instead of string by value Andrew wrote: On 2 Dec, 21:59, "A. McKenney" <alan_mckenn...(a)yahoo.com> wrote: Warning: I'm not entirely on your side. Another approach if you have reason to worry about the inefficiency of copying std::string is to "roll your own" I want to return by value and I am not worried about the p... 8 Dec 2009 19:45
pros and cons of returning const ref to string instead of string by value Andrew wrote: When I write a method that returns a string I always return the string by value. This is as opposed to returning a const reference to the string held as a private data member in the object. Doing it my way means that when the object goes out of scope, my string is still valid. Doing it the ... 3 Dec 2009 03:45
pros and cons of returning const ref to string instead of string by value Andrew wrote: When I write a method that returns a string I always return the string by value. This is as opposed to returning a const reference to the string held as a private data member in the object. Doing it my way means that when the object goes out of scope, my string is still valid. Doing it the ... 8 Dec 2009 21:56
pros and cons of returning const ref to string instead of string by value On Dec 2, 7:06 am, Andrew <marlow.and...(a)googlemail.com> wrote: When I write a method that returns a string I always return the string by value. This is as opposed to returning a const reference to the string held as a private data member in the object. Doing it my way means that when the object goes out of... 6 Dec 2009 23:50
Templated return value "is being used without being initialized" Hi, It would be nice if somebody would be able to give be a pointer here. I have a function with a templated return type. for example: template <class T> T foo() { T retVal; //Just for an example retVal += 10; return retVal; } Let's not dwell on the purpose of the function p... 30 Nov 2009 10:13
C++ Middleware Writer version 1.10 is now on line Release 1.10 of the C++ Middleware Writer is now available on line. This release has the following changes: 1. Support added for stream constructors. Previously types were required to have default constructors in order to be (de)marshalled by the C++ Midddle Writer. A function named Receive was then called... 29 Nov 2009 14:35
inlining of functions returning an unwindable object Hi all. ( Note that I've posted this to microsoft.public.vc.language a few days ago, but didn't really get an answer there, so I hope someone may shed some light on this in a more general context. ) The Visual Studio compiler will never inline a funtion that returns an unwindable object (e.g. std::string, CStr... 2 Dec 2009 17:48
Trying to come to terms with typecasting operators Hi all. I need to inspect the bit patterns in a buffer. In order to do that, I want to print the values of each character to screen as numerical values on hex format. Below is an example program that shows a number of more or less successful attempts to achieve this. The buffer c is initialized with the he... 24 Nov 2009 16:45 |