|
|||||||||||||||||||
HOME | COURSES | TALKS | ARTICLES | GENERICS | LAMBDAS | IOSTREAMS | ABOUT | CONTACT | | | | |||||||||||||||||||
|
Readers Forum
|
||||||||||||||||||
|
|||||||||||||||||||
Discussions and Related InformationSeveral readers came up with ideas and suggestions of their own inspired by topics from the IOStreams book. We would like to share their ideas with interested readers by publishing them here, basically "as is" with a brief introductory comment.List of Topics
Numerous readers mentioned that they prefer the internationalization support in Java over the the internationalization support defined by the C++ Standard, which is described in our book. They felt that Java has much more to offer than C++, especially in the area of Unicode support. This cross-language approach, calling Java from C++, is no longer necessary. There is an open-source project called International Components for Unicode (ICU) that offers Java-style internationalization support in C++. For more information visit IBM's website at http://oss.software.ibm.com/icu/ .
brought to our attention by:
Kevlin Henney suggests a more modern technique for implementation of manipulators with parameters: he uses member function templates, function object types, and parameterized inheritance. This way he avoids passing function pointers, gets rid of the static member function, and eliminates the ugly stream type problem that we describe in section 3.2.2.2. By and large, a very elegant solution that relies heavily on modern template programming techniques. Kevlin's comments are in response to our article published in C++ Report in June 2000. Inspired by his ideas we later published another article on manipulators in the C/C++ Users Journal in June 2001. Below are Kevlin's thoughts on manipulators.
suggested by:
The following occurred to me as a way of avoiding passing function pointers around or running into the stream type problems you describe: #include <iostream> using namespace std;
template<typename
derived>
class mendl : public
manip<mendl>
template<typename
out_stream, typename manip_type>
It is possible to factor out one_arg_manip, two_arg_manip, etc classes,
but for brevity and generality, the code above seems to work fine.
|
|||||||||||||||||||
© Copyright 1995-2005 by Angelika Langer. All Rights Reserved. URL: < http://www.AngelikaLanger.com/IOStreams/forum.htm> last update: 16 Aug 2005 |