comparison DEPENDENCIES/generic/include/boost/format/feed_args.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
68 if(n_after) res.append(static_cast<size_type>(n_after), fill_char); 68 if(n_after) res.append(static_cast<size_type>(n_after), fill_char);
69 } 69 }
70 } // -mk_str(..) 70 } // -mk_str(..)
71 71
72 72
73 #if BOOST_WORKAROUND( BOOST_MSVC, <= 1300) || \ 73 #if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
74 BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) 74 // __DECCXX needs to be tricked to disambiguate this simple overload..
75 // MSVC needs to be tricked to disambiguate this simple overload..
76 // the trick is in "boost/format/msvc_disambiguater.hpp" 75 // the trick is in "boost/format/msvc_disambiguater.hpp"
77 76
78 template< class Ch, class Tr, class T> inline 77 template< class Ch, class Tr, class T> inline
79 void put_head (BOOST_IO_STD basic_ostream<Ch, Tr> & os, const T& x ) { 78 void put_head (BOOST_IO_STD basic_ostream<Ch, Tr> & os, const T& x ) {
80 disambiguater<Ch, Tr, T>::put_head(os, x, 1L); 79 disambiguater<Ch, Tr, T>::put_head(os, x, 1L);
113 template< class Ch, class Tr, class T> inline 112 template< class Ch, class Tr, class T> inline
114 void put_last( BOOST_IO_STD basic_ostream<Ch, Tr> & os, T& x) { 113 void put_last( BOOST_IO_STD basic_ostream<Ch, Tr> & os, T& x) {
115 os << x ; 114 os << x ;
116 } 115 }
117 #endif 116 #endif
118 #endif // -msvc workaround 117 #endif // -__DECCXX workaround
118
119 template< class Ch, class Tr, class T>
120 void call_put_head(BOOST_IO_STD basic_ostream<Ch, Tr> & os, const void* x) {
121 put_head(os, *(typename ::boost::remove_reference<T>::type*)x);
122 }
123
124 template< class Ch, class Tr, class T>
125 void call_put_last(BOOST_IO_STD basic_ostream<Ch, Tr> & os, const void* x) {
126 put_last(os, *(T*)x);
127 }
128
129 template< class Ch, class Tr>
130 struct put_holder {
131 template<class T>
132 put_holder(T& t)
133 : arg(&t),
134 put_head(&call_put_head<Ch, Tr, T>),
135 put_last(&call_put_last<Ch, Tr, T>)
136 {}
137 const void* arg;
138 void (*put_head)(BOOST_IO_STD basic_ostream<Ch, Tr> & os, const void* x);
139 void (*put_last)(BOOST_IO_STD basic_ostream<Ch, Tr> & os, const void* x);
140 };
141
142 template< class Ch, class Tr> inline
143 void put_head( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const put_holder<Ch, Tr>& t) {
144 t.put_head(os, t.arg);
145 }
146
147 template< class Ch, class Tr> inline
148 void put_last( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const put_holder<Ch, Tr>& t) {
149 t.put_last(os, t.arg);
150 }
119 151
120 152
121 template< class Ch, class Tr, class Alloc, class T> 153 template< class Ch, class Tr, class Alloc, class T>
122 void put( T x, 154 void put( T x,
123 const format_item<Ch, Tr, Alloc>& specs, 155 const format_item<Ch, Tr, Alloc>& specs,
256 } 288 }
257 } 289 }
258 290
259 template<class Ch, class Tr, class Alloc, class T> 291 template<class Ch, class Tr, class Alloc, class T>
260 basic_format<Ch, Tr, Alloc>& 292 basic_format<Ch, Tr, Alloc>&
261 feed (basic_format<Ch,Tr, Alloc>& self, T x) { 293 feed_impl (basic_format<Ch,Tr, Alloc>& self, T x) {
262 if(self.dumped_) self.clear(); 294 if(self.dumped_) self.clear();
263 distribute<Ch, Tr, Alloc, T> (self, x); 295 distribute<Ch, Tr, Alloc, T> (self, x);
264 ++self.cur_arg_; 296 ++self.cur_arg_;
265 if(self.bound_.size() != 0) { 297 if(self.bound_.size() != 0) {
266 while( self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_] ) 298 while( self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_] )
267 ++self.cur_arg_; 299 ++self.cur_arg_;
268 } 300 }
269 return self; 301 return self;
270 } 302 }
303
304 template<class Ch, class Tr, class Alloc, class T> inline
305 basic_format<Ch, Tr, Alloc>&
306 feed (basic_format<Ch,Tr, Alloc>& self, T x) {
307 return feed_impl<Ch, Tr, Alloc, const put_holder<Ch, Tr>&>(self, put_holder<Ch, Tr>(x));
308 }
271 309
272 } // namespace detail 310 } // namespace detail
273 } // namespace io 311 } // namespace io
274 } // namespace boost 312 } // namespace boost
275 313