diff --git a/beast/HeapBlock.h b/beast/HeapBlock.h index 045fba5630..116f1f67d9 100644 --- a/beast/HeapBlock.h +++ b/beast/HeapBlock.h @@ -325,8 +325,8 @@ public: zeromem (data, sizeof (ElementType) * numElements); } - /** This typedef can be used to get the type of the heapblock's elements. */ - typedef ElementType Type; + /** This type alias can be used to get the type of the heapblock's elements. */ + using Type = ElementType; private: //============================================================================== diff --git a/beast/asio/bind_handler.h b/beast/asio/bind_handler.h index 968fb86207..b536db6e6a 100644 --- a/beast/asio/bind_handler.h +++ b/beast/asio/bind_handler.h @@ -41,7 +41,7 @@ template class bound_handler { private: - typedef std::tuple ...> args_type; + using args_type = std::tuple ...>; std::decay_t m_handler; args_type m_args; @@ -54,7 +54,7 @@ private: } public: - typedef void result_type; + using result_type = void; explicit bound_handler (DeducedHandler&& handler, Args&&... args) diff --git a/beast/asio/io_latency_probe.h b/beast/asio/io_latency_probe.h index 419b60ebde..158ed9ea37 100644 --- a/beast/asio/io_latency_probe.h +++ b/beast/asio/io_latency_probe.h @@ -36,8 +36,8 @@ template class io_latency_probe { private: - typedef typename Clock::duration duration; - typedef typename Clock::time_point time_point; + using duration = typename Clock::duration; + using time_point = typename Clock::time_point; std::recursive_mutex m_mutex; std::condition_variable_any m_cond; diff --git a/beast/boost/ErrorCode.h b/beast/boost/ErrorCode.h index ea2fb8436b..f87a157573 100644 --- a/beast/boost/ErrorCode.h +++ b/beast/boost/ErrorCode.h @@ -28,7 +28,7 @@ namespace beast { // use boost, and then switch to std::error_code when // it is available on all our supported platforms. // -typedef boost::system::error_code ErrorCode; +using ErrorCode = boost::system::error_code; } diff --git a/beast/chrono/RelativeTime.h b/beast/chrono/RelativeTime.h index f54346db25..0e42e4144d 100644 --- a/beast/chrono/RelativeTime.h +++ b/beast/chrono/RelativeTime.h @@ -51,7 +51,7 @@ public: you can use this to declare a type that is guaranteed to work cleanly. */ - typedef double value_type; + using value_type = double; //============================================================================== /** Creates a RelativeTime. diff --git a/beast/container/buffer_view.h b/beast/container/buffer_view.h index f6cc9f63bd..c153ca9305 100644 --- a/beast/container/buffer_view.h +++ b/beast/container/buffer_view.h @@ -39,13 +39,13 @@ template >::value> struct apply_const { - typedef U type; + using type = U; }; template struct apply_const { - typedef const U type; + using type = const U; }; // is_contiguous is true if C is a contiguous container @@ -161,7 +161,7 @@ private: void assign (Iter first, Iter last) noexcept { - typedef typename std::iterator_traits ::value_type U; + using U = typename std::iterator_traits ::value_type; static_assert (detail::buffer_view_const_compatible ::value, "Cannot convert from 'U const' to 'T', " @@ -190,17 +190,17 @@ private: } public: - typedef T value_type; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef T& reference; - typedef T const& const_reference; - typedef T* pointer; - typedef T const* const_pointer; - typedef T* iterator; - typedef T const* const_iterator; - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; + using value_type = T; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; + using reference = T&; + using const_reference = T const&; + using pointer = T*; + using const_pointer = T const*; + using iterator = T*; + using const_iterator = T const*; + using reverse_iterator = std::reverse_iterator ; + using const_reverse_iterator = std::reverse_iterator ; // default construct buffer_view () noexcept diff --git a/beast/container/const_container.h b/beast/container/const_container.h index 43d02c4909..accd168fcb 100644 --- a/beast/container/const_container.h +++ b/beast/container/const_container.h @@ -30,7 +30,7 @@ template class const_container { private: - typedef Container cont_type; + using cont_type = Container; cont_type m_cont; @@ -46,11 +46,11 @@ protected: } public: - typedef typename cont_type::value_type value_type; - typedef typename cont_type::size_type size_type; - typedef typename cont_type::difference_type difference_type; - typedef typename cont_type::const_iterator iterator; - typedef typename cont_type::const_iterator const_iterator; + using value_type = typename cont_type::value_type; + using size_type = typename cont_type::size_type; + using difference_type = typename cont_type::difference_type; + using iterator = typename cont_type::const_iterator; + using const_iterator = typename cont_type::const_iterator; /** Returns `true` if the container is empty. */ bool diff --git a/beast/container/cyclic_iterator.h b/beast/container/cyclic_iterator.h index 71c20ff956..2afe817a00 100644 --- a/beast/container/cyclic_iterator.h +++ b/beast/container/cyclic_iterator.h @@ -61,7 +61,7 @@ struct cyclic_iterator_category< std::forward_iterator_tag > { - typedef std::forward_iterator_tag type; + using type = std::forward_iterator_tag; }; template<> @@ -69,7 +69,7 @@ struct cyclic_iterator_category< std::bidirectional_iterator_tag > { - typedef std::bidirectional_iterator_tag type; + using type = std::bidirectional_iterator_tag; }; template<> @@ -77,7 +77,7 @@ struct cyclic_iterator_category< std::random_access_iterator_tag > { - typedef std::bidirectional_iterator_tag type; + using type = std::bidirectional_iterator_tag; }; } @@ -94,7 +94,7 @@ template< > struct cyclic_iterator_base { - typedef boost::iterator_facade< + using type = boost::iterator_facade< cyclic_iterator< ContainerIterator >, @@ -109,7 +109,7 @@ struct cyclic_iterator_base typename std::iterator_traits< ContainerIterator >::reference - > type; + >; }; } @@ -153,39 +153,39 @@ public: /** \brief The base type which is a boost::iterator_facade */ - typedef typename detail::cyclic_iterator_base< + using base_type = typename detail::cyclic_iterator_base< ContainerIterator - >::type base_type; + >::type; /** \brief The underlying iterator type */ - typedef ContainerIterator container_iterator_type; + using container_iterator_type = ContainerIterator; /** \brief The value type adapted from \a ContainerIterator */ - typedef typename base_type::value_type value_type; + using value_type = typename base_type::value_type; /** \brief The reference type adapted from \a ContainerIterator */ - typedef typename base_type::reference reference; + using reference = typename base_type::reference; /** \brief The pointer type adapted from \a ContainerIterator */ - typedef typename base_type::pointer pointer; + using pointer = typename base_type::pointer; /** \brief The difference type adapted from \a ContainerIterator */ - typedef typename base_type::difference_type difference_type; + using difference_type = typename base_type::difference_type; /** \brief The iterator category, either Forward or Bidirectional */ - typedef typename base_type::iterator_category iterator_category; + using iterator_category = typename base_type::iterator_category; /** \brief Creates a singular iterator diff --git a/beast/container/detail/aged_unordered_container.h b/beast/container/detail/aged_unordered_container.h index 0b7d178adf..cffa6ea779 100644 --- a/beast/container/detail/aged_unordered_container.h +++ b/beast/container/detail/aged_unordered_container.h @@ -249,7 +249,7 @@ private: }; using list_type = typename boost::intrusive::make_list >::type ; + boost::intrusive::constant_time_size >::type; using cont_type = typename std::conditional < IsMulti, diff --git a/beast/container/tests/aged_associative_container.test.cpp b/beast/container/tests/aged_associative_container.test.cpp index 6a77d5d2d2..1b66f3b356 100644 --- a/beast/container/tests/aged_associative_container.test.cpp +++ b/beast/container/tests/aged_associative_container.test.cpp @@ -113,14 +113,14 @@ public: template struct AllocT { - typedef T value_type; + using value_type = T; - //typedef propagate_on_container_swap : std::true_type::type; + //using std::true_type::type = propagate_on_container_swap :; template struct rebind { - typedef AllocT other; + using other = AllocT ; }; explicit AllocT (int) @@ -170,8 +170,8 @@ public: class MaybeUnordered : public Base { public: - typedef std::less Comp; - typedef CompT MyComp; + using Comp = std::less ; + using MyComp = CompT ; protected: static std::string name_ordered_part() @@ -185,10 +185,10 @@ public: class MaybeUnordered : public Base { public: - typedef std::hash Hash; - typedef std::equal_to Equal; - typedef HashT MyHash; - typedef EqualT MyEqual; + using Hash = std::hash ; + using Equal = std::equal_to ; + using MyHash = HashT ; + using MyEqual = EqualT ; protected: static std::string name_ordered_part() @@ -226,9 +226,9 @@ public: class MaybeMap : public Base { public: - typedef void T; - typedef typename Base::Key Value; - typedef std::vector Values; + using T = void; + using Value = typename Base::Key; + using Values = std::vector ; static typename Base::Key const& extract (Value const& value) { @@ -259,9 +259,9 @@ public: class MaybeMap : public Base { public: - typedef int T; - typedef std::pair Value; - typedef std::vector Values; + using T = int; + using Value = std::pair ; + using Values = std::vector ; static typename Base::Key const& extract (Value const& value) { @@ -326,9 +326,9 @@ public: struct TestTraitsBase { - typedef std::string Key; - typedef std::chrono::steady_clock Clock; - typedef manual_clock ManualClock; + using Key = std::string; + using Clock = std::chrono::steady_clock; + using ManualClock = manual_clock; }; template @@ -337,18 +337,18 @@ public: TestTraitsBase, IsMap>, IsMulti>, IsUnordered> { private: - typedef MaybeUnordered , IsMulti>, IsUnordered> Base; + using Base = MaybeUnordered , IsMulti>, IsUnordered>; public: using typename Base::Key; - typedef std::integral_constant is_unordered; - typedef std::integral_constant is_multi; - typedef std::integral_constant is_map; + using is_unordered = std::integral_constant ; + using is_multi = std::integral_constant ; + using is_map = std::integral_constant ; - typedef std::allocator Alloc; - typedef AllocT MyAlloc; + using Alloc = std::allocator ; + using MyAlloc = AllocT ; static std::string name() { @@ -645,13 +645,13 @@ typename std::enable_if < aged_associative_container_test_base:: checkUnorderedContentsRefRef (C&& c, Values const& v) { - typedef typename std::remove_reference ::type Cont; - typedef TestTraits < + using Cont = typename std::remove_reference ::type; + using Traits = TestTraits < Cont::is_unordered::value, Cont::is_multi::value, Cont::is_map::value - > Traits; - typedef typename Cont::size_type size_type; + >; + using size_type = typename Cont::size_type; auto const hash (c.hash_function()); auto const key_eq (c.key_eq()); for (size_type i (0); i < c.bucket_count(); ++i) @@ -679,13 +679,13 @@ void aged_associative_container_test_base:: checkContentsRefRef (C&& c, Values const& v) { - typedef typename std::remove_reference ::type Cont; - typedef TestTraits < + using Cont = typename std::remove_reference ::type; + using Traits = TestTraits < Cont::is_unordered::value, Cont::is_multi::value, Cont::is_map::value - > Traits; - typedef typename Cont::size_type size_type; + >; + using size_type = typename Cont::size_type; expect (c.size() == v.size()); expect (size_type (std::distance ( @@ -719,12 +719,12 @@ void aged_associative_container_test_base:: checkContents (Cont& c) { - typedef TestTraits < + using Traits = TestTraits < Cont::is_unordered::value, Cont::is_multi::value, Cont::is_map::value - > Traits; - typedef typename Traits::Values Values; + >; + using Values = typename Traits::Values; checkContents (c, Values()); } @@ -740,15 +740,15 @@ typename std::enable_if ::type aged_associative_container_test_base:: testConstructEmpty () { - typedef TestTraits Traits; - typedef typename Traits::Value Value; - typedef typename Traits::Key Key; - typedef typename Traits::T T; - typedef typename Traits::Clock Clock; - typedef typename Traits::Comp Comp; - typedef typename Traits::Alloc Alloc; - typedef typename Traits::MyComp MyComp; - typedef typename Traits::MyAlloc MyAlloc; + using Traits = TestTraits ; + using Value = typename Traits::Value; + using Key = typename Traits::Key; + using T = typename Traits::T; + using Clock = typename Traits::Clock; + using Comp = typename Traits::Comp; + using Alloc = typename Traits::Alloc; + using MyComp = typename Traits::MyComp; + using MyAlloc = typename Traits::MyAlloc; typename Traits::ManualClock clock; //testcase (Traits::name() + " empty"); @@ -785,17 +785,17 @@ typename std::enable_if ::type aged_associative_container_test_base:: testConstructEmpty () { - typedef TestTraits Traits; - typedef typename Traits::Value Value; - typedef typename Traits::Key Key; - typedef typename Traits::T T; - typedef typename Traits::Clock Clock; - typedef typename Traits::Hash Hash; - typedef typename Traits::Equal Equal; - typedef typename Traits::Alloc Alloc; - typedef typename Traits::MyHash MyHash; - typedef typename Traits::MyEqual MyEqual; - typedef typename Traits::MyAlloc MyAlloc; + using Traits = TestTraits ; + using Value = typename Traits::Value; + using Key = typename Traits::Key; + using T = typename Traits::T; + using Clock = typename Traits::Clock; + using Hash = typename Traits::Hash; + using Equal = typename Traits::Equal; + using Alloc = typename Traits::Alloc; + using MyHash = typename Traits::MyHash; + using MyEqual = typename Traits::MyEqual; + using MyAlloc = typename Traits::MyAlloc; typename Traits::ManualClock clock; //testcase (Traits::name() + " empty"); @@ -855,15 +855,15 @@ typename std::enable_if ::type aged_associative_container_test_base:: testConstructRange () { - typedef TestTraits Traits; - typedef typename Traits::Value Value; - typedef typename Traits::Key Key; - typedef typename Traits::T T; - typedef typename Traits::Clock Clock; - typedef typename Traits::Comp Comp; - typedef typename Traits::Alloc Alloc; - typedef typename Traits::MyComp MyComp; - typedef typename Traits::MyAlloc MyAlloc; + using Traits = TestTraits ; + using Value = typename Traits::Value; + using Key = typename Traits::Key; + using T = typename Traits::T; + using Clock = typename Traits::Clock; + using Comp = typename Traits::Comp; + using Alloc = typename Traits::Alloc; + using MyComp = typename Traits::MyComp; + using MyAlloc = typename Traits::MyAlloc; typename Traits::ManualClock clock; auto const v (Traits::values()); @@ -918,17 +918,17 @@ typename std::enable_if ::type aged_associative_container_test_base:: testConstructRange () { - typedef TestTraits Traits; - typedef typename Traits::Value Value; - typedef typename Traits::Key Key; - typedef typename Traits::T T; - typedef typename Traits::Clock Clock; - typedef typename Traits::Hash Hash; - typedef typename Traits::Equal Equal; - typedef typename Traits::Alloc Alloc; - typedef typename Traits::MyHash MyHash; - typedef typename Traits::MyEqual MyEqual; - typedef typename Traits::MyAlloc MyAlloc; + using Traits = TestTraits ; + using Value = typename Traits::Value; + using Key = typename Traits::Key; + using T = typename Traits::T; + using Clock = typename Traits::Clock; + using Hash = typename Traits::Hash; + using Equal = typename Traits::Equal; + using Alloc = typename Traits::Alloc; + using MyHash = typename Traits::MyHash; + using MyEqual = typename Traits::MyEqual; + using MyAlloc = typename Traits::MyAlloc; typename Traits::ManualClock clock; auto const v (Traits::values()); @@ -998,15 +998,15 @@ typename std::enable_if ::type aged_associative_container_test_base:: testConstructInitList () { - typedef TestTraits Traits; - typedef typename Traits::Value Value; - typedef typename Traits::Key Key; - typedef typename Traits::T T; - typedef typename Traits::Clock Clock; - typedef typename Traits::Comp Comp; - typedef typename Traits::Alloc Alloc; - typedef typename Traits::MyComp MyComp; - typedef typename Traits::MyAlloc MyAlloc; + using Traits = TestTraits ; + using Value = typename Traits::Value; + using Key = typename Traits::Key; + using T = typename Traits::T; + using Clock = typename Traits::Clock; + using Comp = typename Traits::Comp; + using Alloc = typename Traits::Alloc; + using MyComp = typename Traits::MyComp; + using MyAlloc = typename Traits::MyAlloc; typename Traits::ManualClock clock; //testcase (Traits::name() + " init-list"); @@ -1023,17 +1023,17 @@ typename std::enable_if ::type aged_associative_container_test_base:: testConstructInitList () { - typedef TestTraits Traits; - typedef typename Traits::Value Value; - typedef typename Traits::Key Key; - typedef typename Traits::T T; - typedef typename Traits::Clock Clock; - typedef typename Traits::Hash Hash; - typedef typename Traits::Equal Equal; - typedef typename Traits::Alloc Alloc; - typedef typename Traits::MyHash MyHash; - typedef typename Traits::MyEqual MyEqual; - typedef typename Traits::MyAlloc MyAlloc; + using Traits = TestTraits ; + using Value = typename Traits::Value; + using Key = typename Traits::Key; + using T = typename Traits::T; + using Clock = typename Traits::Clock; + using Hash = typename Traits::Hash; + using Equal = typename Traits::Equal; + using Alloc = typename Traits::Alloc; + using MyHash = typename Traits::MyHash; + using MyEqual = typename Traits::MyEqual; + using MyAlloc = typename Traits::MyAlloc; typename Traits::ManualClock clock; //testcase (Traits::name() + " init-list"); @@ -1054,9 +1054,9 @@ void aged_associative_container_test_base:: testCopyMove () { - typedef TestTraits Traits; - typedef typename Traits::Value Value; - typedef typename Traits::Alloc Alloc; + using Traits = TestTraits ; + using Value = typename Traits::Value; + using Alloc = typename Traits::Alloc; typename Traits::ManualClock clock; auto const v (Traits::values()); @@ -1136,9 +1136,9 @@ void aged_associative_container_test_base:: testIterator() { - typedef TestTraits Traits; - typedef typename Traits::Value Value; - typedef typename Traits::Alloc Alloc; + using Traits = TestTraits ; + using Value = typename Traits::Value; + using Alloc = typename Traits::Alloc; typename Traits::ManualClock clock; auto const v (Traits::values()); @@ -1199,9 +1199,9 @@ typename std::enable_if ::type aged_associative_container_test_base:: testReverseIterator() { - typedef TestTraits Traits; - typedef typename Traits::Value Value; - typedef typename Traits::Alloc Alloc; + using Traits = TestTraits ; + using Value = typename Traits::Value; + using Alloc = typename Traits::Alloc; typename Traits::ManualClock clock; auto const v (Traits::values()); @@ -1356,7 +1356,7 @@ void aged_associative_container_test_base:: testModifiers() { - typedef TestTraits Traits; + using Traits = TestTraits ; typename Traits::ManualClock clock; auto const v (Traits::values()); auto const l (make_list (v)); @@ -1416,8 +1416,8 @@ void aged_associative_container_test_base:: testChronological () { - typedef TestTraits Traits; - typedef typename Traits::Value Value; + using Traits = TestTraits ; + using Value = typename Traits::Value; typename Traits::ManualClock clock; auto const v (Traits::values()); @@ -1483,7 +1483,7 @@ typename std::enable_if ::type aged_associative_container_test_base:: testArrayCreate() { - typedef TestTraits Traits; + using Traits = TestTraits ; typename Traits::ManualClock clock; auto v (Traits::values()); @@ -1523,7 +1523,7 @@ reverseFillAgedContainer (Container& c, Values const& values) // c.clock() returns an abstract_clock, so dynamic_cast to manual_clock. // VFALCO NOTE This is sketchy - typedef TestTraitsBase::ManualClock ManualClock; + using ManualClock = TestTraitsBase::ManualClock; ManualClock& clk (dynamic_cast (c.clock())); clk.set (0); @@ -1621,7 +1621,7 @@ void aged_associative_container_test_base:: testElementErase () { - typedef TestTraits Traits; + using Traits = TestTraits ; //testcase (Traits::name() + " element erase" testcase ("element erase"); @@ -1751,7 +1751,7 @@ void aged_associative_container_test_base:: testRangeErase () { - typedef TestTraits Traits; + using Traits = TestTraits ; //testcase (Traits::name() + " element erase" testcase ("range erase"); @@ -1784,8 +1784,8 @@ typename std::enable_if ::type aged_associative_container_test_base:: testCompare () { - typedef TestTraits Traits; - typedef typename Traits::Value Value; + using Traits = TestTraits ; + using Value = typename Traits::Value; typename Traits::ManualClock clock; auto const v (Traits::values()); @@ -1819,7 +1819,7 @@ typename std::enable_if ::type aged_associative_container_test_base:: testObservers() { - typedef TestTraits Traits; + using Traits = TestTraits ; typename Traits::ManualClock clock; //testcase (Traits::name() + " observers"); @@ -1838,7 +1838,7 @@ typename std::enable_if ::type aged_associative_container_test_base:: testObservers() { - typedef TestTraits Traits; + using Traits = TestTraits ; typename Traits::ManualClock clock; //testcase (Traits::name() + " observers"); @@ -1862,7 +1862,7 @@ void aged_associative_container_test_base:: testMaybeUnorderedMultiMap () { - typedef TestTraits Traits; + using Traits = TestTraits ; testConstructEmpty (); testConstructRange (); @@ -1886,8 +1886,8 @@ class aged_set_test : public aged_associative_container_test_base public: // Compile time checks - typedef std::string Key; - typedef int T; + using Key = std::string; + using T = int; static_assert (std::is_same < aged_set , diff --git a/beast/crypto/Sha256.h b/beast/crypto/Sha256.h index a772ccb04e..42935c8eda 100644 --- a/beast/crypto/Sha256.h +++ b/beast/crypto/Sha256.h @@ -37,7 +37,7 @@ enum }; /** A container suitable for holding the resulting hash. */ -typedef std::array digest_type; +using digest_type = std::array ; namespace detail { struct Context diff --git a/beast/cxx14/functional.h b/beast/cxx14/functional.h index f1e217f043..faf6cb9f38 100644 --- a/beast/cxx14/functional.h +++ b/beast/cxx14/functional.h @@ -36,7 +36,7 @@ template <> struct equal_to { // VFALCO NOTE Its not clear how to support is_transparent pre c++14 - typedef std::true_type is_transparent; + using is_transparent = std::true_type; template auto operator() (T&& lhs, U&& rhs) const -> diff --git a/beast/cxx14/utility.h b/beast/cxx14/utility.h index fa882c2aa4..119be94771 100644 --- a/beast/cxx14/utility.h +++ b/beast/cxx14/utility.h @@ -31,7 +31,7 @@ namespace std { template struct integer_sequence { - typedef T value_type; + using value_type = T; static_assert (is_integral::value, "std::integer_sequence can only be instantiated with an integral type" ); @@ -70,15 +70,15 @@ template struct make_integer_sequence_unchecked < T, N, integer_sequence > { - typedef typename make_integer_sequence_unchecked< - T, N-1, integer_sequence>::type type; + using type = typename make_integer_sequence_unchecked< + T, N-1, integer_sequence>::type; }; template struct make_integer_sequence_unchecked < T, 0, integer_sequence> { - typedef integer_sequence type; + using type = integer_sequence ; }; template @@ -90,8 +90,8 @@ struct make_integer_sequence_checked static_assert (N >= 0, "N must be non-negative"); - typedef typename make_integer_sequence_unchecked < - T, N, integer_sequence>::type type; + using type = typename make_integer_sequence_unchecked < + T, N, integer_sequence>::type; }; } // detail @@ -116,20 +116,20 @@ namespace detail { template struct index_tuple { - typedef index_tuple next; + using next = index_tuple ; }; template struct build_index_tuple { - typedef typename build_index_tuple ::type::next type; + using type = typename build_index_tuple ::type::next; }; template <> struct build_index_tuple <0> { - typedef index_tuple<> type; + using type = index_tuple<>; }; template > static_assert (N >= 0, "N must be non-negative"); - typedef integer_sequence (Ints)...> type; + using type = integer_sequence (Ints)...>; }; } // detail diff --git a/beast/hash/impl/siphash.cpp b/beast/hash/impl/siphash.cpp index 00782b86fd..9702f5afee 100644 --- a/beast/hash/impl/siphash.cpp +++ b/beast/hash/impl/siphash.cpp @@ -34,9 +34,9 @@ namespace beast { namespace detail { -typedef std::uint64_t u64; -typedef std::uint32_t u32; -typedef std::uint8_t u8; +using u64 = std::uint64_t; +using u32 = std::uint32_t; +using u8 = std::uint8_t; inline u64 diff --git a/beast/hash/tests/hash_append_test.cpp b/beast/hash/tests/hash_append_test.cpp index 1dc6e64923..887278cc0e 100644 --- a/beast/hash/tests/hash_append_test.cpp +++ b/beast/hash/tests/hash_append_test.cpp @@ -235,7 +235,7 @@ private: std::size_t m_seed; PRNG m_prng; - typedef block_stream > base; + using base = block_stream >; friend base; // compress @@ -351,8 +351,8 @@ struct is_contiguously_hashable class hash_append_test : public unit_test::suite { public: - typedef hash_append_tests::SlowKey SlowKey; - typedef hash_append_tests::FastKey FastKey; + using SlowKey = hash_append_tests::SlowKey; + using FastKey = hash_append_tests::FastKey; struct results_t { diff --git a/beast/hash/tests/hash_metrics.h b/beast/hash/tests/hash_metrics.h index e0c5212186..3d42747c90 100644 --- a/beast/hash/tests/hash_metrics.h +++ b/beast/hash/tests/hash_metrics.h @@ -51,7 +51,7 @@ template float distribution_factor (FwdIter first, FwdIter last) { - typedef typename FwdIter::value_type value_type; + using value_type = typename FwdIter::value_type; static_assert (std::is_unsigned ::value, ""); const unsigned nbits = CHAR_BIT * sizeof(std::size_t); diff --git a/beast/http/basic_parser.h b/beast/http/basic_parser.h index 769bfbf9d6..a0397f49c3 100644 --- a/beast/http/basic_parser.h +++ b/beast/http/basic_parser.h @@ -61,9 +61,9 @@ private: void *data; }; - typedef int (*data_cb_t) ( + using data_cb_t = int (*) ( state_t*, const char *at, size_t length); - typedef int (*cb_t) (state_t*); + using cb_t = int (*) (state_t*); struct hooks_t { @@ -87,7 +87,7 @@ private: std::string value_; public: - typedef boost::system::error_code error_code; + using error_code = boost::system::error_code; virtual ~basic_parser() = default; diff --git a/beast/http/body.h b/beast/http/body.h index 69ac0b85a5..82679256e7 100644 --- a/beast/http/body.h +++ b/beast/http/body.h @@ -35,13 +35,13 @@ namespace http { class body { private: - typedef boost::asio::streambuf buffer_type; + using buffer_type = boost::asio::streambuf; // Hack: use unique_ptr because streambuf cant be moved std::unique_ptr buf_; public: - typedef buffer_type::const_buffers_type const_buffers_type; + using const_buffers_type = buffer_type::const_buffers_type; body(); body (body&& other); diff --git a/beast/http/detail/header_traits.h b/beast/http/detail/header_traits.h index 274ca2601a..28a98bd6eb 100644 --- a/beast/http/detail/header_traits.h +++ b/beast/http/detail/header_traits.h @@ -37,9 +37,9 @@ template > using basic_field_string = std::basic_string ; -typedef basic_field_string <> field_string; +using field_string = basic_field_string <>; -typedef boost::basic_string_ref field_string_ref; +using field_string_ref = boost::basic_string_ref ; /** Returns `true` if two header fields are the same. The comparison is case-insensitive. diff --git a/beast/http/headers.h b/beast/http/headers.h index ba06fcfbe6..940047312b 100644 --- a/beast/http/headers.h +++ b/beast/http/headers.h @@ -76,21 +76,21 @@ private: } }; - typedef boost::intrusive::make_list - >::type list_t; + >::type; - typedef boost::intrusive::make_set - >::type set_t; + >::type; list_t list_; set_t set_; public: - typedef boost::transform_iterator iterator; - typedef iterator const_iterator; + using iterator = boost::transform_iterator ; + using const_iterator = iterator; ~headers() { diff --git a/beast/http/impl/http-parser/README.md b/beast/http/impl/http-parser/README.md index 0bf5d359ac..f280ff3403 100644 --- a/beast/http/impl/http-parser/README.md +++ b/beast/http/impl/http-parser/README.md @@ -128,9 +128,9 @@ save certain data for later usage, you can do that from the callbacks. There are two types of callbacks: -* notification `typedef int (*http_cb) (http_parser*);` +* notification `using http_cb = int (*) (http_parser*);` Callbacks: on_message_begin, on_headers_complete, on_message_complete. -* data `typedef int (*http_data_cb) (http_parser*, const char *at, size_t length);` +* data `using http_data_cb = int (*) (http_parser*, const char *at, size_t length);` Callbacks: (requests only) on_uri, (common) on_header_field, on_header_value, on_body; diff --git a/beast/http/impl/joyent_parser.cpp b/beast/http/impl/joyent_parser.cpp index 50c8f715dd..da444b1a3d 100644 --- a/beast/http/impl/joyent_parser.cpp +++ b/beast/http/impl/joyent_parser.cpp @@ -111,8 +111,8 @@ convert_http_errno (joyent::http_errno err) : public boost::system::error_category { private: - typedef boost::system::error_code error_code; - typedef boost::system::error_condition error_condition; + using error_code = boost::system::error_code; + using error_condition = boost::system::error_condition; public: char const* diff --git a/beast/http/raw_parser.h b/beast/http/raw_parser.h index cc87d07af1..47e4b20697 100644 --- a/beast/http/raw_parser.h +++ b/beast/http/raw_parser.h @@ -43,7 +43,7 @@ namespace http { class raw_parser { private: - typedef boost::system::error_code error_code; + using error_code = boost::system::error_code; public: enum message_type @@ -174,9 +174,9 @@ private: void *data; }; - typedef int (*data_cb_t) ( + using data_cb_t = int (*) ( state_t*, const char *at, size_t length); - typedef int (*cb_t) (state_t*); + using cb_t = int (*) (state_t*); struct hooks_t { diff --git a/beast/insight/BaseImpl.h b/beast/insight/BaseImpl.h index 6c3d7821d3..4deb3a46be 100644 --- a/beast/insight/BaseImpl.h +++ b/beast/insight/BaseImpl.h @@ -32,7 +32,7 @@ namespace insight { class BaseImpl { public: - typedef std::shared_ptr ptr; + using ptr = std::shared_ptr ; virtual ~BaseImpl () = 0; }; diff --git a/beast/insight/Collector.h b/beast/insight/Collector.h index 3b72174da3..e177c3f6ee 100644 --- a/beast/insight/Collector.h +++ b/beast/insight/Collector.h @@ -44,7 +44,7 @@ namespace insight { class Collector { public: - typedef std::shared_ptr ptr; + using ptr = std::shared_ptr ; virtual ~Collector() = 0; diff --git a/beast/insight/Counter.h b/beast/insight/Counter.h index 8086bc58b0..6ec79ec3e7 100644 --- a/beast/insight/Counter.h +++ b/beast/insight/Counter.h @@ -39,7 +39,7 @@ namespace insight { class Counter : public Base { public: - typedef CounterImpl::value_type value_type; + using value_type = CounterImpl::value_type; /** Create a null metric. A null metric reports no information. diff --git a/beast/insight/CounterImpl.h b/beast/insight/CounterImpl.h index 3bc11f9617..06f57e8059 100644 --- a/beast/insight/CounterImpl.h +++ b/beast/insight/CounterImpl.h @@ -32,7 +32,7 @@ class CounterImpl , public BaseImpl { public: - typedef std::int64_t value_type; + using value_type = std::int64_t; virtual ~CounterImpl () = 0; virtual void increment (value_type amount) = 0; diff --git a/beast/insight/Event.h b/beast/insight/Event.h index c3a166f0f3..ae504900fb 100644 --- a/beast/insight/Event.h +++ b/beast/insight/Event.h @@ -43,7 +43,7 @@ namespace insight { class Event : public Base { public: - typedef EventImpl::value_type value_type; + using value_type = EventImpl::value_type; /** Create a null metric. A null metric reports no information. diff --git a/beast/insight/EventImpl.h b/beast/insight/EventImpl.h index 7611b29873..07f6d73890 100644 --- a/beast/insight/EventImpl.h +++ b/beast/insight/EventImpl.h @@ -32,7 +32,7 @@ class EventImpl , public BaseImpl { public: - typedef std::chrono::milliseconds value_type; + using value_type = std::chrono::milliseconds; virtual ~EventImpl () = 0; virtual void notify (value_type const& value) = 0; diff --git a/beast/insight/Gauge.h b/beast/insight/Gauge.h index 3c296f09a3..6e6c580dbe 100644 --- a/beast/insight/Gauge.h +++ b/beast/insight/Gauge.h @@ -40,8 +40,8 @@ namespace insight { class Gauge : public Base { public: - typedef GaugeImpl::value_type value_type; - typedef GaugeImpl::difference_type difference_type; + using value_type = GaugeImpl::value_type; + using difference_type = GaugeImpl::difference_type; /** Create a null metric. A null metric reports no information. diff --git a/beast/insight/GaugeImpl.h b/beast/insight/GaugeImpl.h index 9d19a567d5..06703973f8 100644 --- a/beast/insight/GaugeImpl.h +++ b/beast/insight/GaugeImpl.h @@ -32,8 +32,8 @@ class GaugeImpl , public BaseImpl { public: - typedef std::uint64_t value_type; - typedef std::int64_t difference_type; + using value_type = std::uint64_t; + using difference_type = std::int64_t; virtual ~GaugeImpl () = 0; virtual void set (value_type value) = 0; diff --git a/beast/insight/Group.h b/beast/insight/Group.h index 858f8c3b4a..e895403a96 100644 --- a/beast/insight/Group.h +++ b/beast/insight/Group.h @@ -32,7 +32,7 @@ namespace insight { class Group : public Collector { public: - typedef std::shared_ptr ptr; + using ptr = std::shared_ptr ; /** Returns the name of this group, for diagnostics. */ virtual std::string const& name () const = 0; diff --git a/beast/insight/HookImpl.h b/beast/insight/HookImpl.h index 4b9ab72042..35ee91bc88 100644 --- a/beast/insight/HookImpl.h +++ b/beast/insight/HookImpl.h @@ -30,7 +30,7 @@ class HookImpl , public BaseImpl { public: - typedef std::function HandlerType; + using HandlerType = std::function ; virtual ~HookImpl () = 0; }; diff --git a/beast/insight/Meter.h b/beast/insight/Meter.h index b8cde62a6d..709b28d5b3 100644 --- a/beast/insight/Meter.h +++ b/beast/insight/Meter.h @@ -38,7 +38,7 @@ namespace insight { class Meter : public Base { public: - typedef MeterImpl::value_type value_type; + using value_type = MeterImpl::value_type; /** Create a null metric. A null metric reports no information. diff --git a/beast/insight/MeterImpl.h b/beast/insight/MeterImpl.h index de354722a2..defa546e08 100644 --- a/beast/insight/MeterImpl.h +++ b/beast/insight/MeterImpl.h @@ -32,7 +32,7 @@ class MeterImpl , public BaseImpl { public: - typedef std::uint64_t value_type; + using value_type = std::uint64_t; virtual ~MeterImpl () = 0; virtual void increment (value_type amount) = 0; diff --git a/beast/insight/impl/Groups.cpp b/beast/insight/impl/Groups.cpp index f8f3f3e6b9..f909ef1dac 100644 --- a/beast/insight/impl/Groups.cpp +++ b/beast/insight/impl/Groups.cpp @@ -31,7 +31,7 @@ class GroupImp , public Group { public: - typedef std::vector > Items; + using Items = std::vector >; std::string const m_name; Collector::ptr m_collector; @@ -91,7 +91,7 @@ private: class GroupsImp : public Groups { public: - typedef std::unordered_map , uhash <>> Items; + using Items = std::unordered_map , uhash <>>; Collector::ptr m_collector; Items m_items; diff --git a/beast/insight/impl/StatsDCollector.cpp b/beast/insight/impl/StatsDCollector.cpp index 7e7056c8e9..55f0f5b0cd 100644 --- a/beast/insight/impl/StatsDCollector.cpp +++ b/beast/insight/impl/StatsDCollector.cpp @@ -197,7 +197,7 @@ private: List metrics; }; - typedef SharedData State; + using State = SharedData ; Journal m_journal; IP::Endpoint m_address; diff --git a/beast/intrusive/List.h b/beast/intrusive/List.h index 6005eea2fb..d1abe618dd 100644 --- a/beast/intrusive/List.h +++ b/beast/intrusive/List.h @@ -37,13 +37,13 @@ namespace detail { template struct CopyConst { - typedef typename std::remove_const ::type type; + using type = typename std::remove_const ::type; }; template struct CopyConst { - typedef typename std::remove_const ::type const type; + using type = typename std::remove_const ::type const; }; /** @} */ @@ -55,7 +55,7 @@ template class ListNode { private: - typedef T value_type; + using value_type = T; friend class List; @@ -73,11 +73,11 @@ class ListIterator : public std::iterator < std::bidirectional_iterator_tag, std::size_t> { public: - typedef typename detail::CopyConst < - N, typename N::value_type>::type value_type; - typedef value_type* pointer; - typedef value_type& reference; - typedef std::size_t size_type; + using value_type = typename detail::CopyConst < + N, typename N::value_type>::type; + using pointer = value_type*; + using reference = value_type&; + using size_type = std::size_t; ListIterator (N* node = nullptr) noexcept : m_node (node) @@ -242,8 +242,8 @@ private: struct ProcessTag { }; struct UpdateTag { }; - typedef List ProcessList; - typedef List UpdateList; + using ProcessList = List ; + using UpdateList = List ; // Derive from both node types so we can be in each list at once. // @@ -267,18 +267,18 @@ template class List { public: - typedef typename detail::ListNode Node; + using Node = typename detail::ListNode ; - typedef T value_type; - typedef value_type* pointer; - typedef value_type& reference; - typedef value_type const* const_pointer; - typedef value_type const& const_reference; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; + using value_type = T; + using pointer = value_type*; + using reference = value_type&; + using const_pointer = value_type const*; + using const_reference = value_type const&; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; - typedef detail::ListIterator iterator; - typedef detail::ListIterator const_iterator; + using iterator = detail::ListIterator ; + using const_iterator = detail::ListIterator ; /** Create an empty list. */ List () diff --git a/beast/intrusive/LockFreeStack.h b/beast/intrusive/LockFreeStack.h index 92d9201fe2..1fb1b4febf 100644 --- a/beast/intrusive/LockFreeStack.h +++ b/beast/intrusive/LockFreeStack.h @@ -42,18 +42,18 @@ class LockFreeStackIterator typename Container::reference>::type> { protected: - typedef typename Container::Node Node; - typedef typename std::conditional < - IsConst, Node const*, Node*>::type NodePtr; + using Node = typename Container::Node; + using NodePtr = typename std::conditional < + IsConst, Node const*, Node*>::type; public: - typedef typename Container::value_type value_type; - typedef typename std::conditional ::type pointer; - typedef typename std::conditional ::type; + using reference = typename std::conditional ::type reference; + typename Container::reference>::type; LockFreeStackIterator () : m_node () @@ -167,17 +167,17 @@ public: }; public: - typedef Element value_type; - typedef Element* pointer; - typedef Element& reference; - typedef Element const* const_pointer; - typedef Element const& const_reference; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef LockFreeStackIterator < - LockFreeStack , false> iterator; - typedef LockFreeStackIterator < - LockFreeStack , true> const_iterator; + using value_type = Element; + using pointer = Element*; + using reference = Element&; + using const_pointer = Element const*; + using const_reference = Element const&; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; + using iterator = LockFreeStackIterator < + LockFreeStack , false>; + using const_iterator = LockFreeStackIterator < + LockFreeStack , true>; LockFreeStack () : m_end (nullptr) diff --git a/beast/module/core/containers/Array.h b/beast/module/core/containers/Array.h index 6ef234a7e8..c9d8295b27 100644 --- a/beast/module/core/containers/Array.h +++ b/beast/module/core/containers/Array.h @@ -57,7 +57,7 @@ template class DefaultElementComparator { private: - typedef ElementType ParameterType; + using ParameterType = ElementType; public: static int compareElements (ParameterType first, ParameterType second) diff --git a/beast/module/core/diagnostic/SemanticVersion.cpp b/beast/module/core/diagnostic/SemanticVersion.cpp index aba2dc7588..9a31b4f33e 100644 --- a/beast/module/core/diagnostic/SemanticVersion.cpp +++ b/beast/module/core/diagnostic/SemanticVersion.cpp @@ -322,7 +322,7 @@ int compare (SemanticVersion const& lhs, SemanticVersion const& rhs) class SemanticVersion_test: public unit_test::suite { - typedef SemanticVersion::identifier_list identifier_list; + using identifier_list = SemanticVersion::identifier_list; public: void checkPass (std::string const& input, bool shouldPass = true) diff --git a/beast/module/core/diagnostic/SemanticVersion.h b/beast/module/core/diagnostic/SemanticVersion.h index 0b7ef0862a..a2a3311a6c 100644 --- a/beast/module/core/diagnostic/SemanticVersion.h +++ b/beast/module/core/diagnostic/SemanticVersion.h @@ -37,7 +37,7 @@ namespace beast { class SemanticVersion { public: - typedef std::vector identifier_list; + using identifier_list = std::vector; int majorVersion; int minorVersion; diff --git a/beast/module/core/memory/MemoryBlock.h b/beast/module/core/memory/MemoryBlock.h index 8c080dd72a..76f5aa1bd6 100644 --- a/beast/module/core/memory/MemoryBlock.h +++ b/beast/module/core/memory/MemoryBlock.h @@ -74,8 +74,8 @@ public: #endif // Standard container interface - typedef char* iterator; - typedef char const* const_iterator; + using iterator = char*; + using const_iterator = char const*; inline iterator begin () noexcept { return static_cast (getData ()); } inline iterator end () noexcept { return addBytesToPointer (begin (), size); } inline const_iterator cbegin () const noexcept { return static_cast (getConstData ()); } diff --git a/beast/module/core/native/posix_SharedCode.h b/beast/module/core/native/posix_SharedCode.h index e4036ae4f3..c1d18bce19 100644 --- a/beast/module/core/native/posix_SharedCode.h +++ b/beast/module/core/native/posix_SharedCode.h @@ -104,10 +104,10 @@ namespace { #if BEAST_LINUX || \ (BEAST_IOS && ! __DARWIN_ONLY_64_BIT_INO_T) // (this iOS stuff is to avoid a simulator bug) - typedef struct stat64 beast_statStruct; + using beast_statStruct = struct stat64; #define BEAST_STAT stat64 #else - typedef struct stat beast_statStruct; + using beast_statStruct = struct stat; #define BEAST_STAT stat #endif diff --git a/beast/module/core/system/SystemStats.h b/beast/module/core/system/SystemStats.h index b325abefdf..81e1ccf802 100644 --- a/beast/module/core/system/SystemStats.h +++ b/beast/module/core/system/SystemStats.h @@ -52,7 +52,7 @@ namespace SystemStats getStackBacktrace(); /** A void() function type, used by setApplicationCrashHandler(). */ - typedef void (*CrashHandlerFunction)(); + using CrashHandlerFunction = void (*)(); /** Sets up a global callback function that will be called if the application executes some kind of illegal instruction. diff --git a/beast/module/core/thread/DeadlineTimer.cpp b/beast/module/core/thread/DeadlineTimer.cpp index 9685277543..740b97e23a 100644 --- a/beast/module/core/thread/DeadlineTimer.cpp +++ b/beast/module/core/thread/DeadlineTimer.cpp @@ -26,8 +26,8 @@ class DeadlineTimer::Manager : protected Thread { private: - typedef CriticalSection LockType; - typedef List Items; + using LockType = CriticalSection; + using Items = List ; public: Manager () : Thread ("DeadlineTimer::Manager") diff --git a/beast/module/core/threads/CriticalSection.h b/beast/module/core/threads/CriticalSection.h index 9120b0ee72..8d5eb96bd1 100644 --- a/beast/module/core/threads/CriticalSection.h +++ b/beast/module/core/threads/CriticalSection.h @@ -92,13 +92,13 @@ public: //============================================================================== /** Provides the type of scoped lock to use with a CriticalSection. */ - typedef GenericScopedLock ScopedLockType; + using ScopedLockType = GenericScopedLock ; /** Provides the type of scoped unlocker to use with a CriticalSection. */ - typedef GenericScopedUnlock ScopedUnlockType; + using ScopedUnlockType = GenericScopedUnlock ; /** Provides the type of scoped try-locker to use with a CriticalSection. */ - typedef GenericScopedTryLock ScopedTryLockType; + using ScopedTryLockType = GenericScopedTryLock ; //-------------------------------------------------------------------------- // @@ -161,7 +161,7 @@ public: }; /** A dummy scoped-unlocker type to use with a dummy critical section. */ - typedef ScopedLockType ScopedUnlockType; + using ScopedUnlockType = ScopedLockType; }; //============================================================================== @@ -187,7 +187,7 @@ public: @see CriticalSection, ScopedUnlock */ -typedef CriticalSection::ScopedLockType ScopedLock; +using ScopedLock = CriticalSection::ScopedLockType; //============================================================================== /** @@ -227,7 +227,7 @@ typedef CriticalSection::ScopedLockType ScopedLock; @see CriticalSection, ScopedLock */ -typedef CriticalSection::ScopedUnlockType ScopedUnlock; +using ScopedUnlock = CriticalSection::ScopedUnlockType; //============================================================================== /** @@ -260,7 +260,7 @@ typedef CriticalSection::ScopedUnlockType ScopedUnlock; @see CriticalSection::tryEnter, ScopedLock, ScopedUnlock, ScopedReadLock */ -typedef CriticalSection::ScopedTryLockType ScopedTryLock; +using ScopedTryLock = CriticalSection::ScopedTryLockType; } // beast diff --git a/beast/module/core/time/AtExitHook.cpp b/beast/module/core/time/AtExitHook.cpp index fae8090d49..2ed6129f6e 100644 --- a/beast/module/core/time/AtExitHook.cpp +++ b/beast/module/core/time/AtExitHook.cpp @@ -86,8 +86,8 @@ private: } }; - typedef CriticalSection MutexType; - typedef MutexType::ScopedLockType ScopedLockType; + using MutexType = CriticalSection; + using ScopedLockType = MutexType::ScopedLockType; static StaticDestructor s_staticDestructor; diff --git a/beast/module/core/time/Time.cpp b/beast/module/core/time/Time.cpp index bbf9e38d24..40b18aec04 100644 --- a/beast/module/core/time/Time.cpp +++ b/beast/module/core/time/Time.cpp @@ -92,11 +92,11 @@ namespace TimeHelpers static inline String formatString (const String& format, const struct tm* const tm) { #if BEAST_ANDROID - typedef CharPointer_UTF8 StringType; + using StringType = CharPointer_UTF8; #elif BEAST_WINDOWS - typedef CharPointer_UTF16 StringType; + using StringType = CharPointer_UTF16; #else - typedef CharPointer_UTF32 StringType; + using StringType = CharPointer_UTF32; #endif for (size_t bufferSize = 256; ; bufferSize += 256) diff --git a/beast/net/DynamicBuffer.h b/beast/net/DynamicBuffer.h index 04bcb8f288..0e4a733d81 100644 --- a/beast/net/DynamicBuffer.h +++ b/beast/net/DynamicBuffer.h @@ -36,7 +36,7 @@ public: defaultBlocksize = 32 * 1024 }; - typedef std::size_t size_type; + using size_type = std::size_t; /** Create the dynamic buffer with the specified block size. */ explicit DynamicBuffer (size_type blocksize = defaultBlocksize); @@ -116,7 +116,7 @@ public: std::string to_string () const; private: - typedef std::vector Buffers; + using Buffers = std::vector ; size_type m_blocksize; size_type m_size; diff --git a/beast/net/IPAddressV4.h b/beast/net/IPAddressV4.h index 5a811c2124..bd1a6359bd 100644 --- a/beast/net/IPAddressV4.h +++ b/beast/net/IPAddressV4.h @@ -109,8 +109,8 @@ struct AddressV4 class Proxy { public: - typedef typename std::conditional < - IsConst, std::uint32_t const*, std::uint32_t*>::type Pointer; + using Pointer = typename std::conditional < + IsConst, std::uint32_t const*, std::uint32_t*>::type; Proxy (int shift, Pointer value) : m_shift (shift) diff --git a/beast/net/IPEndpoint.h b/beast/net/IPEndpoint.h index 4cdbbdab20..6e3961a3c1 100644 --- a/beast/net/IPEndpoint.h +++ b/beast/net/IPEndpoint.h @@ -30,7 +30,7 @@ namespace beast { namespace IP { -typedef std::uint16_t Port; +using Port = std::uint16_t; /** A version-independent IP address and port combination. */ class Endpoint diff --git a/beast/smart_ptr/SharedObject.h b/beast/smart_ptr/SharedObject.h index c26db20ac1..cfa4ee6275 100644 --- a/beast/smart_ptr/SharedObject.h +++ b/beast/smart_ptr/SharedObject.h @@ -42,9 +42,9 @@ namespace beast { { void foo(); - // This is a neat way of declaring a typedef for a pointer class, + // This is a neat way of declaring a using Ptr = for a pointer class, // rather than typing out the full templated name each time.. - typedef SharedPtr Ptr; + using Ptr = SharedPtr; }; MyClass::Ptr p = new MyClass(); diff --git a/beast/smart_ptr/SharedPtr.h b/beast/smart_ptr/SharedPtr.h index 7201cc2c0b..db092d4abb 100644 --- a/beast/smart_ptr/SharedPtr.h +++ b/beast/smart_ptr/SharedPtr.h @@ -48,12 +48,12 @@ namespace beast { reference-countable class by implementing a pair of methods called incReferenceCount() and decReferenceCount(). - When using this class, you'll probably want to create a typedef to + When using this class, you'll probably want to create a using MyClassPtr = to abbreviate the full templated name - e.g. @code - typedef SharedPtr MyClassPtr; + using MyClassPtr = SharedPtr ; @endcode @@ -63,10 +63,10 @@ template class SharedPtr { public: - typedef T value_type; + using value_type = T; /** The class being referenced by this container. */ - typedef T ReferencedType; + using ReferencedType = T; /** Construct a container pointing to nothing. */ SharedPtr () noexcept diff --git a/beast/streams/abstract_ostream.h b/beast/streams/abstract_ostream.h index a99c9171c3..b4275feff9 100644 --- a/beast/streams/abstract_ostream.h +++ b/beast/streams/abstract_ostream.h @@ -25,7 +25,7 @@ namespace beast { /** An abstract ostream for `char`. */ -typedef basic_abstract_ostream abstract_ostream; +using abstract_ostream = basic_abstract_ostream ; } diff --git a/beast/streams/basic_abstract_ostream.h b/beast/streams/basic_abstract_ostream.h index 7d1932a5e1..82341b7880 100644 --- a/beast/streams/basic_abstract_ostream.h +++ b/beast/streams/basic_abstract_ostream.h @@ -36,8 +36,8 @@ template < class basic_abstract_ostream { public: - typedef std::basic_string string_type; - typedef basic_scoped_ostream scoped_stream_type; + using string_type = std::basic_string ; + using scoped_stream_type = basic_scoped_ostream ; basic_abstract_ostream() = default; diff --git a/beast/streams/basic_scoped_ostream.h b/beast/streams/basic_scoped_ostream.h index 861cf01291..bb403d4eec 100644 --- a/beast/streams/basic_scoped_ostream.h +++ b/beast/streams/basic_scoped_ostream.h @@ -54,11 +54,11 @@ template < class basic_scoped_ostream { private: - typedef std::function const&)> handler_t; + using handler_t = std::function const&)>; - typedef std::basic_ostringstream < - CharT, Traits, Allocator> stream_type; + using stream_type = std::basic_ostringstream < + CharT, Traits, Allocator>; handler_t m_handler; @@ -81,7 +81,7 @@ private: #endif public: - typedef std::basic_string string_type; + using string_type = std::basic_string ; // Disallow copy since that would duplicate the output basic_scoped_ostream (basic_scoped_ostream const&) = delete; diff --git a/beast/streams/basic_std_ostream.h b/beast/streams/basic_std_ostream.h index d47839ca8c..316d53a4d4 100644 --- a/beast/streams/basic_std_ostream.h +++ b/beast/streams/basic_std_ostream.h @@ -53,7 +53,7 @@ public: } }; -typedef basic_std_ostream std_ostream; +using std_ostream = basic_std_ostream ; //------------------------------------------------------------------------------ diff --git a/beast/strings/CharPointer_ASCII.h b/beast/strings/CharPointer_ASCII.h index 3970bc7252..18e8bf6ec9 100644 --- a/beast/strings/CharPointer_ASCII.h +++ b/beast/strings/CharPointer_ASCII.h @@ -45,7 +45,7 @@ namespace beast { class CharPointer_ASCII { public: - typedef char CharType; + using CharType = char; inline explicit CharPointer_ASCII (const CharType* const rawPointer) noexcept : data (const_cast (rawPointer)) diff --git a/beast/strings/CharPointer_UTF16.h b/beast/strings/CharPointer_UTF16.h index 400108e9f4..9c0a511a17 100644 --- a/beast/strings/CharPointer_UTF16.h +++ b/beast/strings/CharPointer_UTF16.h @@ -42,9 +42,9 @@ class CharPointer_UTF16 { public: #if BEAST_NATIVE_WCHAR_IS_UTF16 - typedef wchar_t CharType; + using CharType = wchar_t; #else - typedef std::int16_t CharType; + using CharType = std::int16_t; #endif inline explicit CharPointer_UTF16 (const CharType* const rawPointer) noexcept diff --git a/beast/strings/CharPointer_UTF32.h b/beast/strings/CharPointer_UTF32.h index 9b0f36e679..18c98eff6b 100644 --- a/beast/strings/CharPointer_UTF32.h +++ b/beast/strings/CharPointer_UTF32.h @@ -41,7 +41,7 @@ namespace beast { class CharPointer_UTF32 { public: - typedef beast_wchar CharType; + using CharType = beast_wchar; inline explicit CharPointer_UTF32 (const CharType* const rawPointer) noexcept : data (const_cast (rawPointer)) diff --git a/beast/strings/CharPointer_UTF8.h b/beast/strings/CharPointer_UTF8.h index f8f28c2903..3be82e5284 100644 --- a/beast/strings/CharPointer_UTF8.h +++ b/beast/strings/CharPointer_UTF8.h @@ -42,7 +42,7 @@ namespace beast { class CharPointer_UTF8 { public: - typedef char CharType; + using CharType = char; inline explicit CharPointer_UTF8 (const CharType* const rawPointer) noexcept : data (const_cast (rawPointer)) diff --git a/beast/strings/CharacterFunctions.h b/beast/strings/CharacterFunctions.h index b3037e24c9..e3de00c8a5 100644 --- a/beast/strings/CharacterFunctions.h +++ b/beast/strings/CharacterFunctions.h @@ -49,9 +49,9 @@ namespace beast { #if BEAST_NATIVE_WCHAR_IS_UTF32 || DOXYGEN /** A platform-independent 32-bit unicode character type. */ - typedef wchar_t beast_wchar; + using beast_wchar = wchar_t; #else - typedef std::uint32_t beast_wchar; + using beast_wchar = std::uint32_t; #endif #ifndef DOXYGEN diff --git a/beast/strings/String.h b/beast/strings/String.h index 8924910874..bad0fdc677 100644 --- a/beast/strings/String.h +++ b/beast/strings/String.h @@ -49,11 +49,11 @@ namespace beast { #if BEAST_NATIVE_WCHAR_IS_UTF8 - typedef CharPointer_UTF8 CharPointer_wchar_t; + using CharPointer_wchar_t = CharPointer_UTF8; #elif BEAST_NATIVE_WCHAR_IS_UTF16 - typedef CharPointer_UTF16 CharPointer_wchar_t; + using CharPointer_wchar_t = CharPointer_UTF16; #else - typedef CharPointer_UTF32 CharPointer_wchar_t; + using CharPointer_wchar_t = CharPointer_UTF32; #endif //============================================================================== @@ -186,7 +186,7 @@ public: static const String empty; /** This is the character encoding type used internally to store the string. */ - typedef StringCharPointerType CharPointerType; + using CharPointerType = StringCharPointerType; //============================================================================== /** Generates a probably-unique 32-bit hashcode from this string. */ diff --git a/beast/strings/StringCharPointerType.h b/beast/strings/StringCharPointerType.h index ec9f457378..8468530ea7 100644 --- a/beast/strings/StringCharPointerType.h +++ b/beast/strings/StringCharPointerType.h @@ -44,13 +44,13 @@ namespace beast { toUTF32() methods let you access the string's content in any of the other formats. */ #if (BEAST_STRING_UTF_TYPE == 32) -typedef CharPointer_UTF32 StringCharPointerType; +using StringCharPointerType = CharPointer_UTF32; #elif (BEAST_STRING_UTF_TYPE == 16) -typedef CharPointer_UTF16 StringCharPointerType; +using StringCharPointerType = CharPointer_UTF16; #elif (BEAST_STRING_UTF_TYPE == 8) -typedef CharPointer_UTF8 StringCharPointerType; +using StringCharPointerType = CharPointer_UTF8; #else #error "You must set the value of BEAST_STRING_UTF_TYPE to be either 8, 16, or 32!" diff --git a/beast/strings/impl/String.cpp b/beast/strings/impl/String.cpp index a25d1340b9..dbe1595edd 100644 --- a/beast/strings/impl/String.cpp +++ b/beast/strings/impl/String.cpp @@ -82,8 +82,8 @@ public: text[0] = 0; } - typedef String::CharPointerType CharPointerType; - typedef String::CharPointerType::CharType CharType; + using CharPointerType = String::CharPointerType; + using CharType = String::CharPointerType::CharType; //============================================================================== static CharPointerType createUninitialisedBytes (const size_t numBytes) @@ -1872,7 +1872,7 @@ struct StringEncodingConverter { String& source = const_cast (s); - typedef typename CharPointerType_Dest::CharType DestChar; + using DestChar = typename CharPointerType_Dest::CharType; if (source.isEmpty()) return CharPointerType_Dest (reinterpret_cast (&emptyChar)); diff --git a/beast/threads/RecursiveMutex.h b/beast/threads/RecursiveMutex.h index 129377cfa0..57edf8cecd 100644 --- a/beast/threads/RecursiveMutex.h +++ b/beast/threads/RecursiveMutex.h @@ -39,9 +39,9 @@ namespace beast { class RecursiveMutex { public: - typedef std::lock_guard ScopedLockType; - typedef UnlockGuard ScopedUnlockType; - typedef TryLockGuard ScopedTryLockType; + using ScopedLockType = std::lock_guard ; + using ScopedUnlockType = UnlockGuard ; + using ScopedTryLockType = TryLockGuard ; /** Create the mutex. The mutux is initially unowned. diff --git a/beast/threads/ScopedWrapperContext.h b/beast/threads/ScopedWrapperContext.h index ac7dee6688..1505f836bc 100644 --- a/beast/threads/ScopedWrapperContext.h +++ b/beast/threads/ScopedWrapperContext.h @@ -56,8 +56,8 @@ template class ScopedWrapperContext { public: - typedef Context context_type; - typedef ScopedType scoped_type; + using context_type = Context; + using scoped_type = ScopedType; class Scope { diff --git a/beast/threads/SharedData.h b/beast/threads/SharedData.h index d58976a5b5..9c64129878 100644 --- a/beast/threads/SharedData.h +++ b/beast/threads/SharedData.h @@ -72,7 +72,7 @@ namespace beast { String value2; }; - typedef SharedData SharedState; + using SharedState = SharedData ; SharedState m_state; @@ -113,11 +113,11 @@ template class SharedLockGuard { public: - typedef Mutex MutexType; + using MutexType = Mutex; explicit SharedLockGuard (Mutex const& mutex) : m_mutex (mutex) diff --git a/beast/threads/SharedMutexAdapter.h b/beast/threads/SharedMutexAdapter.h index 4cf3f03ec8..06e443da16 100644 --- a/beast/threads/SharedMutexAdapter.h +++ b/beast/threads/SharedMutexAdapter.h @@ -35,9 +35,9 @@ template class SharedMutexAdapter { public: - typedef Mutex MutexType; - typedef std::lock_guard LockGuardType; - typedef SharedLockGuard SharedLockGuardType; + using MutexType = Mutex; + using LockGuardType = std::lock_guard ; + using SharedLockGuardType = SharedLockGuard ; void lock() const { diff --git a/beast/threads/SpinLock.h b/beast/threads/SpinLock.h index 733f4f51c8..4d517da23b 100644 --- a/beast/threads/SpinLock.h +++ b/beast/threads/SpinLock.h @@ -50,10 +50,10 @@ class SpinLock { public: /** Provides the type of scoped lock to use for locking a SpinLock. */ - typedef std::lock_guard ScopedLockType; + using ScopedLockType = std::lock_guard ; /** Provides the type of scoped unlocker to use with a SpinLock. */ - typedef UnlockGuard ScopedUnlockType; + using ScopedUnlockType = UnlockGuard ; SpinLock() : m_lock (0) diff --git a/beast/threads/Stoppable.h b/beast/threads/Stoppable.h index 70ee0ae92c..873ee2fb11 100644 --- a/beast/threads/Stoppable.h +++ b/beast/threads/Stoppable.h @@ -253,7 +253,7 @@ private: friend class RootStoppable; struct Child; - typedef LockFreeStack Children; + using Children = LockFreeStack ; struct Child : Children::Node { diff --git a/beast/threads/TryLockGuard.h b/beast/threads/TryLockGuard.h index 4b70e9b2b9..adc53406fa 100644 --- a/beast/threads/TryLockGuard.h +++ b/beast/threads/TryLockGuard.h @@ -26,7 +26,7 @@ template class TryLockGuard { public: - typedef Mutex MutexType; + using MutexType = Mutex; explicit TryLockGuard (Mutex const& mutex) : m_mutex (mutex) diff --git a/beast/threads/UnlockGuard.h b/beast/threads/UnlockGuard.h index be87fef263..6007000d54 100644 --- a/beast/threads/UnlockGuard.h +++ b/beast/threads/UnlockGuard.h @@ -26,7 +26,7 @@ template class UnlockGuard { public: - typedef Mutex MutexType; + using MutexType = Mutex; explicit UnlockGuard (Mutex const& mutex) : m_mutex (mutex) diff --git a/beast/threads/detail/DispatchedHandler.h b/beast/threads/detail/DispatchedHandler.h index c4c303dd18..a18d51e409 100644 --- a/beast/threads/detail/DispatchedHandler.h +++ b/beast/threads/detail/DispatchedHandler.h @@ -34,7 +34,7 @@ private: Handler m_handler; public: - typedef void result_type; + using result_type = void; DispatchedHandler (Dispatcher dispatcher, Handler& handler) : m_dispatcher (dispatcher) diff --git a/beast/threads/semaphore.h b/beast/threads/semaphore.h index 096a057446..a0bff2fe5f 100644 --- a/beast/threads/semaphore.h +++ b/beast/threads/semaphore.h @@ -29,14 +29,14 @@ template class basic_semaphore { private: - typedef std::unique_lock scoped_lock; + using scoped_lock = std::unique_lock ; Mutex m_mutex; CondVar m_cond; std::size_t m_count; public: - typedef std::size_t size_type; + using size_type = std::size_t; /** Create the semaphore, with an optional initial count. If unspecified, the initial count is zero. @@ -79,7 +79,7 @@ public: } }; -typedef basic_semaphore semaphore; +using semaphore = basic_semaphore ; } #endif diff --git a/beast/unit_test/suite.h b/beast/unit_test/suite.h index 1b54a6ec6e..b88f19b985 100644 --- a/beast/unit_test/suite.h +++ b/beast/unit_test/suite.h @@ -141,7 +141,7 @@ public: Multiline output sent to the stream will be atomically written to the underlying abstract_Ostream */ - typedef abstract_ostream::scoped_stream_type scoped_stream; + using scoped_stream = abstract_ostream::scoped_stream_type; /** Memberspace for logging. */ log_t log; diff --git a/beast/utility/PropertyStream.h b/beast/utility/PropertyStream.h index d9ce7ad441..d81317310b 100644 --- a/beast/utility/PropertyStream.h +++ b/beast/utility/PropertyStream.h @@ -286,7 +286,7 @@ private: List children; }; - typedef SharedData SharedState; + using SharedState = SharedData ; std::string const m_name; SharedState m_state; diff --git a/beast/utility/hash_pair.h b/beast/utility/hash_pair.h index ded3afffc1..74c3bd44e6 100644 --- a/beast/utility/hash_pair.h +++ b/beast/utility/hash_pair.h @@ -35,8 +35,8 @@ struct hash > , private boost::base_from_member , 1> { private: - typedef boost::base_from_member , 0> first_hash; - typedef boost::base_from_member , 1> second_hash; + using first_hash = boost::base_from_member , 0>; + using second_hash = boost::base_from_member , 1>; public: hash () diff --git a/beast/utility/impl/PropertyStream.cpp b/beast/utility/impl/PropertyStream.cpp index bfbd028846..9f521fc1c8 100644 --- a/beast/utility/impl/PropertyStream.cpp +++ b/beast/utility/impl/PropertyStream.cpp @@ -604,7 +604,7 @@ void PropertyStream::add (long double value) class PropertyStream_test : public unit_test::suite { public: - typedef PropertyStream::Source Source; + using Source = PropertyStream::Source; void test_peel_name (std::string s, std::string const& expected, std::string const& expected_remainder) diff --git a/beast/utility/is_call_possible.h b/beast/utility/is_call_possible.h index 25d0dfd064..08b4c9e456 100644 --- a/beast/utility/is_call_possible.h +++ b/beast/utility/is_call_possible.h @@ -32,13 +32,13 @@ namespace is_call_possible_detail template struct add_reference { - typedef Z& type; + using type = Z&; }; template struct add_reference { - typedef Z& type; + using type = Z&; }; template class void_exp_result {}; @@ -52,13 +52,13 @@ namespace is_call_possible_detail template struct clone_constness { - typedef dest_type type; + using type = dest_type; }; template struct clone_constness { - typedef const dest_type type; + using type = const dest_type; }; } @@ -165,7 +165,7 @@ template struct trait_name \ { \ private: \ - typedef std::remove_reference_t
Z; \ + using Z = std::remove_reference_t
; \ class yes {}; \ class no { yes m[2]; }; \ struct derived : public Z \ @@ -175,7 +175,7 @@ private: private: derived (); \ }; \ \ - typedef typename beast::is_call_possible_detail::clone_constness::type derived_type; \ + using derived_type = typename beast::is_call_possible_detail::clone_constness::type; \ \ template \ struct return_value_check \ diff --git a/beast/utility/maybe_const.h b/beast/utility/maybe_const.h index 3fd63c3a6c..1de13373c4 100644 --- a/beast/utility/maybe_const.h +++ b/beast/utility/maybe_const.h @@ -28,9 +28,9 @@ namespace beast { template struct maybe_const { - typedef typename std::conditional ::type const, - typename std::remove_const ::type>::type type; + typename std::remove_const ::type>::type; }; /** Alias for omitting `typename`. */ diff --git a/beast/utility/tagged_integer.h b/beast/utility/tagged_integer.h index 3f9545c54c..83f00ccc55 100644 --- a/beast/utility/tagged_integer.h +++ b/beast/utility/tagged_integer.h @@ -53,8 +53,8 @@ private: Int m_value; public: - typedef Int value_type; - typedef Tag tag_type; + using value_type = Int; + using tag_type = Tag; tagged_integer() = default; diff --git a/beast/utility/tests/empty_base_optimization.test.cpp b/beast/utility/tests/empty_base_optimization.test.cpp index 10808df5ae..a4448a5831 100644 --- a/beast/utility/tests/empty_base_optimization.test.cpp +++ b/beast/utility/tests/empty_base_optimization.test.cpp @@ -35,7 +35,7 @@ public: class test1 : private empty_base_optimization { - typedef empty_base_optimization Base; + using Base = empty_base_optimization; void* m_p; public: explicit test1 (T const& t) diff --git a/beast/utility/tests/static_initializer.test.cpp b/beast/utility/tests/static_initializer.test.cpp index 39b2e99ad9..3a00085c58 100644 --- a/beast/utility/tests/static_initializer.test.cpp +++ b/beast/utility/tests/static_initializer.test.cpp @@ -38,7 +38,7 @@ public: struct Case { enum { count = N }; - typedef Tag type; + using type = Tag; }; struct Counts diff --git a/beast/utility/tests/tagged_integer.test.cpp b/beast/utility/tests/tagged_integer.test.cpp index a8b7e61197..2e011c0256 100644 --- a/beast/utility/tests/tagged_integer.test.cpp +++ b/beast/utility/tests/tagged_integer.test.cpp @@ -35,9 +35,9 @@ private: struct Tag1 { }; struct Tag2 { }; - typedef tagged_integer TagInt1; - typedef tagged_integer TagInt2; - typedef tagged_integer TagInt3; + using TagInt1 = tagged_integer ; + using TagInt2 = tagged_integer ; + using TagInt3 = tagged_integer ; // Check construction of tagged_integers static_assert (std::is_constructible::value, diff --git a/beast/utility/type_name.h b/beast/utility/type_name.h index fadf8d9076..039a3c86c3 100644 --- a/beast/utility/type_name.h +++ b/beast/utility/type_name.h @@ -42,7 +42,7 @@ template std::string type_name() { - typedef typename std::remove_reference::type TR; + using TR = typename std::remove_reference::type; std::unique_ptr own ( #ifndef _MSC_VER abi::__cxa_demangle (typeid(TR).name(), nullptr, diff --git a/beast/weak_fn.h b/beast/weak_fn.h index 67eb335d0e..b15982c1b4 100644 --- a/beast/weak_fn.h +++ b/beast/weak_fn.h @@ -90,7 +90,7 @@ class weak_binder : private beast::empty_base_optimization { private: - typedef R (T::*member_type)(Args...); + using member_type = R (T::*)(Args...); using pointer_type = std::weak_ptr; using shared_type = std::shared_ptr; member_type member_;