@@ -203,12 +203,11 @@ namespace detail
203203 tuple_for_each<I-1 ,Tup>::unload (tup, err_id);
204204 }
205205
206- template <class CharT , class Traits >
207- static void print (std::basic_ostream<CharT, Traits> & os, void const * tup, error_id to_print, char const * & prefix)
206+ static void write_to (writer & w, void const * tup, error_id id)
208207 {
209208 BOOST_LEAF_ASSERT (tup != nullptr );
210- tuple_for_each<I-1 ,Tup>::print (os , tup, to_print, prefix );
211- std::get<I-1 >(*static_cast <Tup const *>(tup)).print (os, to_print, prefix );
209+ tuple_for_each<I-1 ,Tup>::write_to (w , tup, id );
210+ std::get<I-1 >(*static_cast <Tup const *>(tup)).write_to (w, id );
212211 }
213212 };
214213
@@ -218,14 +217,13 @@ namespace detail
218217 BOOST_LEAF_CONSTEXPR static void activate ( Tup & ) noexcept { }
219218 BOOST_LEAF_CONSTEXPR static void deactivate ( Tup & ) noexcept { }
220219 BOOST_LEAF_CONSTEXPR static void unload ( Tup &, int ) noexcept { }
221- template <class CharT , class Traits >
222- BOOST_LEAF_CONSTEXPR static void print (std::basic_ostream<CharT, Traits> &, void const *, error_id, char const * &) { }
220+ BOOST_LEAF_CONSTEXPR static void write_to (writer &, void const *, error_id) { }
223221 };
224222
225- template <class Tup , class CharT , class Traits >
226- BOOST_LEAF_CONSTEXPR void print_tuple_contents (std::basic_ostream<CharT, Traits> & os , void const * tup, error_id to_print, char const * & prefix )
223+ template <class Tup >
224+ BOOST_LEAF_CONSTEXPR void serialize_tuple_contents (writer & w , void const * tup, error_id id )
227225 {
228- tuple_for_each<std::tuple_size<Tup>::value, Tup>::print (os , tup, to_print, prefix );
226+ tuple_for_each<std::tuple_size<Tup>::value, Tup>::write_to (w , tup, id );
229227 }
230228} // namespace detail
231229
@@ -369,17 +367,17 @@ class context
369367 return is_active_;
370368 }
371369
372- template <class CharT , class Traits >
373- void print ( std::basic_ostream<CharT, Traits> & os ) const
370+ void write_to ( writer & w ) const
374371 {
375- char const * prefix = " Contents:" ;
376- detail::print_tuple_contents<Tup>(os, &tup_, error_id (), prefix);
372+ detail::serialize_tuple_contents<Tup>(w, &tup_, error_id ());
377373 }
378374
379375 template <class CharT , class Traits >
380376 friend std::ostream & operator <<( std::basic_ostream<CharT, Traits> & os, context const & ctx )
381377 {
382- ctx.print (os);
378+ char const * prefix = " Contents:" ;
379+ ostream_writer w (os, prefix, BOOST_LEAF_CFG_DIAGNOSTICS_DELIMITER);
380+ ctx.write_to (w);
383381 return os << ' \n ' ;
384382 }
385383
0 commit comments