[Patch] modernize the codebase of Boost.Format which replace the old typdef with using alias
frex_vk9 via Boost <[email protected]> Sun, 14 Jun 2026 17:17:34 +0000
| Newsgroups | gmane.comp.lib.boost.devel |
|---|---|
| Message-ID | <2XYLvJ-FGyA_N4XO9aBJuhGXSgFvPbPLcXSncJnypobOm7UlG7CWQVyLBOmfVeRZiiZeuKnq_37R-wTayB06Tiq5DcFMGXLtaxaAr6iVSh4=@proton.me> |
Hello. I saw that Boost require C++11 so i modernize the codebase of Boost.Format i replaced the old typedef with using alias for upgrade the lisibility for codebase in the future. and the test with b2 passed. Read the .patch file for review my commit. Regards. [email protected] _______________________________________________ Boost mailing list -- [email protected] To unsubscribe send an email to [email protected] https://lists.boost.org/mailman3/lists/boost.lists.boost.org/ Archived at: https://lists.boost.org/archives/list/[email protected]/message/73BN644CYBD76ZC7DTY43PVL62KU4UUZ/
modernization_codebase_with_using.patch
(application/octet-stream, 11.9 KB)
diff --git a/include/boost/format/alt_sstream.hpp b/include/boost/format/alt_sstream.hpp
index 3a0a07a..9f8705f 100644
--- a/include/boost/format/alt_sstream.hpp
+++ b/include/boost/format/alt_sstream.hpp
@@ -39,20 +39,20 @@ namespace boost {
class basic_altstringbuf
: public ::std::basic_streambuf<Ch, Tr>
{
- typedef ::std::basic_streambuf<Ch, Tr> streambuf_t;
- typedef typename CompatAlloc<Alloc>::compatible_type compat_allocator_type;
- typedef typename CompatTraits<Tr>::compatible_type compat_traits_type;
+ using streambuf_t = ::std::basic_streambuf<Ch, Tr>;
+ using compat_allocator_type = typename CompatAlloc<Alloc>::compatible_type;
+ using compat_traits_type = typename CompatTraits<Tr>::compatible_type;
public:
- typedef Ch char_type;
- typedef Tr traits_type;
- typedef typename compat_traits_type::int_type int_type;
- typedef typename compat_traits_type::pos_type pos_type;
- typedef typename compat_traits_type::off_type off_type;
- typedef Alloc allocator_type;
- typedef ::std::basic_string<Ch, Tr, Alloc> string_type;
- typedef typename string_type::size_type size_type;
+ using char_type = Ch;
+ using traits_type = Tr;
+ using int_type = typename compat_traits_type::int_type;
+ using pos_type = typename compat_traits_type::pos_type;
+ using off_type = typename compat_traits_type::off_type;
+ using allocator_type = Alloc;
+ using string_type = ::std::basic_string<Ch, Tr, Alloc>;
+ using size_type = typename string_type::size_type;
- typedef ::std::streamsize streamsize;
+ using streamsize = ::std::streamsize;
explicit basic_altstringbuf(std::ios_base::openmode mode
@@ -129,13 +129,12 @@ namespace boost {
template<class T>
const T & operator()(const T & arg) { return arg; }
};
- typedef ::std::basic_ostream<Ch, Tr> stream_t;
- typedef boost::base_from_member<boost::shared_ptr<
- basic_altstringbuf<Ch,Tr, Alloc> > >
- pbase_type;
- typedef ::std::basic_string<Ch, Tr, Alloc> string_type;
- typedef typename string_type::size_type size_type;
- typedef basic_altstringbuf<Ch, Tr, Alloc> stringbuf_t;
+ using stream_t = ::std::basic_ostream<Ch, Tr>;
+ using pbase_type = boost::base_from_member<boost::shared_ptr<
+ basic_altstringbuf<Ch,Tr, Alloc> > >;
+ using string_type = ::std::basic_string<Ch, Tr, Alloc>;
+ using size_type = typename string_type::size_type;
+ using stringbuf_t = basic_altstringbuf<Ch, Tr, Alloc>;
public:
typedef Alloc allocator_type;
basic_oaltstringstream()
diff --git a/include/boost/format/detail/compat_workarounds.hpp b/include/boost/format/detail/compat_workarounds.hpp
index 8e51514..d52cc81 100644
--- a/include/boost/format/detail/compat_workarounds.hpp
+++ b/include/boost/format/detail/compat_workarounds.hpp
@@ -70,7 +70,7 @@ namespace boost {
class CompatTraits
{ // general case : be transparent
public:
- typedef Tr compatible_type;
+ using compatible_type = Tr;
};
// **** CompatAlloc general definitions : -----------------------------
@@ -78,7 +78,7 @@ namespace boost {
class CompatAlloc
{ // general case : be transparent
public:
- typedef Alloc compatible_type;
+ using compatible_type = Alloc;
};
} //N.S. io
diff --git a/include/boost/format/detail/config_macros.hpp b/include/boost/format/detail/config_macros.hpp
index 9bd9e6b..83331de 100644
--- a/include/boost/format/detail/config_macros.hpp
+++ b/include/boost/format/detail/config_macros.hpp
@@ -83,9 +83,9 @@ namespace boost {
// this typedef is either std::locale or int, avoids placing ifdefs everywhere
namespace boost { namespace io { namespace detail {
#if ! defined(BOOST_NO_STD_LOCALE)
- typedef BOOST_IO_STD locale locale_t;
+ using locale_t = BOOST_IO_STD locale;
#else
- typedef int locale_t;
+ using locale_t = int;
#endif
} } }
diff --git a/include/boost/format/detail/workarounds_gcc-2_95.hpp b/include/boost/format/detail/workarounds_gcc-2_95.hpp
index 8c49d42..98ad65a 100644
--- a/include/boost/format/detail/workarounds_gcc-2_95.hpp
+++ b/include/boost/format/detail/workarounds_gcc-2_95.hpp
@@ -85,7 +85,7 @@ namespace std {
};
- typedef ios ios_base;
+ using ios_base = ios;
template <class Ch, class Tr>
class basic_ostream;
@@ -110,12 +110,12 @@ namespace boost {
: public ::std::string_char_traits<Ch>
{
public:
- typedef CompatTraits compatible_type;
+ using compatible_type = CompatTraits;
- typedef Ch char_type;
- typedef int int_type;
- typedef ::std::streampos pos_type;
- typedef ::std::streamoff off_type;
+ using char_type = Ch;
+ using int_type = int;
+ using pos_type = ::std::streampos;
+ using off_type = ::std::streamoff;
static char_type
to_char_type(const int_type& meta) {
@@ -139,7 +139,7 @@ namespace boost {
template<class Ch>
class CompatTraits< ::std::char_traits<Ch> > {
public:
- typedef CompatTraits< ::std::string_char_traits<Ch> > compatible_type;
+ using compatible_type = CompatTraits< ::std::string_char_traits<Ch> >;
};
// ** CompatAlloc gcc-2.95 specialisations ---------------------------
@@ -147,7 +147,7 @@ namespace boost {
class CompatAlloc< ::std::alloc>
{
public:
- typedef ::std::allocator<char> compatible_type;
+ using compatible_type = ::std::allocator<char>;
};
} // N.S. io
diff --git a/include/boost/format/feed_args.hpp b/include/boost/format/feed_args.hpp
index b0e520e..e0cbdec 100644
--- a/include/boost/format/feed_args.hpp
+++ b/include/boost/format/feed_args.hpp
@@ -167,9 +167,9 @@ namespace detail {
// does the actual conversion of x, with given params, into a string
// using the supplied stringbuf.
- typedef typename basic_format<Ch, Tr, Alloc>::string_type string_type;
- typedef typename basic_format<Ch, Tr, Alloc>::format_item_t format_item_t;
- typedef typename string_type::size_type size_type;
+ using string_type = typename basic_format<Ch, Tr, Alloc>::string_type;
+ using format_item_t = typename basic_format<Ch, Tr, Alloc>::format_item_t;
+ using size_type = typename string_type::size_type;
basic_oaltstringstream<Ch, Tr, Alloc> oss( &buf);
diff --git a/include/boost/format/format_class.hpp b/include/boost/format/format_class.hpp
index a7ccc29..9077c0f 100644
--- a/include/boost/format/format_class.hpp
+++ b/include/boost/format/format_class.hpp
@@ -31,11 +31,11 @@ namespace boost {
{
typedef typename io::CompatTraits<Tr>::compatible_type compat_traits;
public:
- typedef Ch CharT; // borland fails in operator% if we use Ch and Tr directly
- typedef std::basic_string<Ch, Tr, Alloc> string_type;
- typedef typename string_type::size_type size_type;
- typedef io::detail::format_item<Ch, Tr, Alloc> format_item_t;
- typedef io::basic_altstringbuf<Ch, Tr, Alloc> internal_streambuf_t;
+ using CharT = Ch; // borland fails in operator% if we use Ch and Tr directly
+ using string_type = std::basic_string<Ch, Tr, Alloc> ;
+ using size_type = typename string_type::size_type ;
+ using format_item_t = io::detail::format_item<Ch, Tr, Alloc> ;
+ using internal_streambuf_t = io::basic_altstringbuf<Ch, Tr, Alloc> ;
explicit basic_format(const Ch* str=NULL);
@@ -153,7 +153,7 @@ namespace boost {
private:
#endif
- typedef io::detail::stream_format_state<Ch, Tr> stream_format_state;
+ using stream_format_state = io::detail::stream_format_state<Ch, Tr>;
// flag bits, used for style_
enum style_values { ordered = 1, // set only if all directives are positional
special_needs = 4 };
diff --git a/include/boost/format/format_fwd.hpp b/include/boost/format/format_fwd.hpp
index 16b8565..70da725 100644
--- a/include/boost/format/format_fwd.hpp
+++ b/include/boost/format/format_fwd.hpp
@@ -16,7 +16,7 @@
#include <string>
#include <iosfwd>
-#include <boost/format/detail/compat_workarounds.hpp>
+#include <boost/format/detail/compat_workarounds.hpp>
namespace boost {
@@ -24,10 +24,10 @@ namespace boost {
class Tr = BOOST_IO_STD char_traits<Ch>, class Alloc = std::allocator<Ch> >
class basic_format;
- typedef basic_format<char > format;
+ using format = basic_format<char > ;
#if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_STD_WSTREAMBUF)
- typedef basic_format<wchar_t > wformat;
+ using wformat = basic_format<wchar_t >;
#endif
namespace io {
diff --git a/include/boost/format/free_funcs.hpp b/include/boost/format/free_funcs.hpp
index 3a51545..e369bad 100644
--- a/include/boost/format/free_funcs.hpp
+++ b/include/boost/format/free_funcs.hpp
@@ -40,7 +40,7 @@ namespace boost {
#endif
// effect: "return os << str(f);" but we can do it faster
{
- typedef boost::basic_format<Ch, Tr, Alloc> format_t;
+ using format_t = boost::basic_format<Ch, Tr, Alloc>;
if(f.items_.size()==0)
os << f.prefix_;
else {
diff --git a/include/boost/format/internals.hpp b/include/boost/format/internals.hpp
index cd5fc54..aea33c8 100644
--- a/include/boost/format/internals.hpp
+++ b/include/boost/format/internals.hpp
@@ -34,7 +34,7 @@ namespace detail {
template<class Ch, class Tr>
struct stream_format_state
{
- typedef BOOST_IO_STD basic_ios<Ch, Tr> basic_ios;
+ using basic_ios = BOOST_IO_STD basic_ios<Ch, Tr>;
stream_format_state(Ch fill) { reset(fill); }
// stream_format_state(const basic_ios& os) { set_by_stream(os); }
@@ -72,9 +72,9 @@ namespace detail {
argN_tabulation = -2, // tabulation directive. (no argument read)
argN_ignored = -3 // ignored directive. (no argument read)
};
- typedef BOOST_IO_STD basic_ios<Ch, Tr> basic_ios;
- typedef detail::stream_format_state<Ch, Tr> stream_format_state;
- typedef ::std::basic_string<Ch, Tr, Alloc> string_type;
+ using basic_ios = BOOST_IO_STD basic_ios<Ch, Tr>;
+ using stream_format_state = detail::stream_format_state<Ch, Tr>;
+ using string_type = ::std::basic_string<Ch, Tr, Alloc>;
format_item(Ch fill) :argN_(argN_no_posit), fmtstate_(fill),
truncate_(max_streamsize()), pad_scheme_(0) {}
diff --git a/include/boost/format/parsing.hpp b/include/boost/format/parsing.hpp
index 0007492..78a45e8 100644
--- a/include/boost/format/parsing.hpp
+++ b/include/boost/format/parsing.hpp
@@ -109,7 +109,7 @@ namespace detail {
const Facet& fac,
std::size_t offset, unsigned char exceptions)
{
- typedef typename basic_format<Ch, Tr, Alloc>::format_item_t format_item_t;
+ using format_item_t = typename basic_format<Ch, Tr, Alloc>::format_item_t;
fpar->argN_ = format_item_t::argN_no_posit; // if no positional-directive
bool precision_set = false;