Boost logo

Boost-Commit :

From: az_sw_dude_at_[hidden]
Date: 2007-05-22 23:58:03


Author: az_sw_dude
Date: 2007-05-22 23:58:02 EDT (Tue, 22 May 2007)
New Revision: 4204
URL: http://svn.boost.org/trac/boost/changeset/4204

Log:
Various changes for g++4 on linux - including adding new line to end of file, refactoring of template specialization, and changing header include to ios.

Text files modified:
   sandbox/explore/boost/explore/explore.hpp | 3
   sandbox/explore/boost/explore/stream_container.hpp | 89 +++++++++++++++++++++++++++++++--------
   sandbox/explore/boost/explore/stream_state.hpp | 2
   3 files changed, 72 insertions(+), 22 deletions(-)

Modified: sandbox/explore/boost/explore/explore.hpp
==============================================================================
--- sandbox/explore/boost/explore/explore.hpp (original)
+++ sandbox/explore/boost/explore/explore.hpp 2007-05-22 23:58:02 EDT (Tue, 22 May 2007)
@@ -349,4 +349,5 @@
 
 }
 
-#endif //__EXPLORE_HPP_INCLUDED__
\ No newline at end of file
+#endif //__EXPLORE_HPP_INCLUDED__
+

Modified: sandbox/explore/boost/explore/stream_container.hpp
==============================================================================
--- sandbox/explore/boost/explore/stream_container.hpp (original)
+++ sandbox/explore/boost/explore/stream_container.hpp 2007-05-22 23:58:02 EDT (Tue, 22 May 2007)
@@ -24,6 +24,65 @@
 
 namespace boost
 {
+
+
+ namespace detail
+ {
+
+ template<typename charType>
+ std::basic_string<charType> init_separator();
+
+ template<>
+ std::basic_string<char>
+ init_separator<char>()
+ {
+ return ", ";
+ }
+
+ template<>
+ std::basic_string<wchar_t>
+ init_separator<wchar_t>()
+ {
+ return L", ";
+ }
+
+ template<typename charType>
+ std::basic_string<charType> init_start();
+
+ template<>
+ std::basic_string<char>
+ init_start<char>()
+ {
+ return "[";
+ }
+
+ template<>
+ std::basic_string<wchar_t>
+ init_start<wchar_t>()
+ {
+ return L"[";
+ }
+
+ template<typename charType>
+ std::basic_string<charType> init_end();
+
+ template<>
+ std::basic_string<char>
+ init_end<char>()
+ {
+ return "]";
+ }
+
+ template<>
+ std::basic_string<wchar_t>
+ init_end<wchar_t>()
+ {
+ return L"]";
+ }
+
+
+ }
+
         // A simple collection of additional stream state
         template<typename Elem, typename Tr>
         struct container_stream_state
@@ -37,23 +96,12 @@
                 // is there an easier way to specialize between char and wchar_t?
                 // Concern: this is only specialized for char and wchar_t streams.
                 template<typename El>
- void init();
-
- template<>
- void init<char>()
- {
- separator = ", ";
- start = "[";
- end = "]";
- }
-
- template<>
- void init<wchar_t>()
- {
- separator = L", ";
- start = L"[";
- end = L"]";
- }
+ void init()
+ {
+ separator = detail::init_separator<El>();
+ start = detail::init_start<El>();
+ end = detail::init_end<El>();
+ }
 
                 str_typ separator;
                 str_typ start;
@@ -105,8 +153,8 @@
                 // starting delimiter
                 ostr << state->start;
 
- C::const_iterator first = c.begin();
- C::const_iterator last = c.end();
+ typename C::const_iterator first = c.begin();
+ typename C::const_iterator last = c.end();
                 while( first != last )
                 {
                         // value
@@ -125,8 +173,9 @@
         template<typename Elem, typename Tr, typename C>
         void stream_container(std::basic_ostream<Elem, Tr>& ostr, const C& c)
         {
+ typedef typename C::value_type value_type;
                 // redirect with "normal" streaming.
- stream_container(ostr, c, &stream_normal_value<Elem, Tr, C::value_type>);
+ stream_container(ostr, c, &stream_normal_value<Elem, Tr, value_type>);
         }
 
         // concern: this will match everything that does not have a streaming operator. I'm not sure this is

Modified: sandbox/explore/boost/explore/stream_state.hpp
==============================================================================
--- sandbox/explore/boost/explore/stream_state.hpp (original)
+++ sandbox/explore/boost/explore/stream_state.hpp 2007-05-22 23:58:02 EDT (Tue, 22 May 2007)
@@ -15,7 +15,7 @@
 #ifndef stream_state_h_
 #define stream_state_h_
 
-#include <xiosbase> // TODO: is this a standard header?
+#include <ios>
 #include <memory>
 
 namespace explore


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk