Commit 3618ae79 authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook GitHub Bot

change some typedefs to using statements in Range.h

Summary:
To address some lint warnings about C++ modernization, replace typedefs in
Range.h with `using` declarations.

Reviewed By: yfeldblum, ot, voznesenskym

Differential Revision: D32635799

fbshipit-source-id: a4d5a66b1a840fe36fd60661c21a52a4baaeeed9
parent 0121c4ee
...@@ -124,13 +124,13 @@ struct IsCharPointer {}; ...@@ -124,13 +124,13 @@ struct IsCharPointer {};
template <> template <>
struct IsCharPointer<char*> { struct IsCharPointer<char*> {
typedef int type; using type = int;
}; };
template <> template <>
struct IsCharPointer<const char*> { struct IsCharPointer<const char*> {
typedef int const_type; using const_type = int;
typedef int type; using type = int;
}; };
} // namespace detail } // namespace detail
...@@ -153,13 +153,13 @@ class Range { ...@@ -153,13 +153,13 @@ class Range {
using string = std::basic_string<char, std::char_traits<char>, Alloc>; using string = std::basic_string<char, std::char_traits<char>, Alloc>;
public: public:
typedef std::size_t size_type; using size_type = std::size_t;
typedef Iter iterator; using iterator = Iter;
typedef Iter const_iterator; using const_iterator = Iter;
typedef typename std::remove_reference< using value_type = typename std::remove_reference<
typename std::iterator_traits<Iter>::reference>::type value_type; typename std::iterator_traits<Iter>::reference>::type;
using difference_type = typename std::iterator_traits<Iter>::difference_type; using difference_type = typename std::iterator_traits<Iter>::difference_type;
typedef typename std::iterator_traits<Iter>::reference reference; using reference = typename std::iterator_traits<Iter>::reference;
/** /**
* For MutableStringPiece and MutableByteRange we define StringPiece * For MutableStringPiece and MutableByteRange we define StringPiece
...@@ -167,14 +167,14 @@ class Range { ...@@ -167,14 +167,14 @@ class Range {
* identity). We do that to enable operations such as find with * identity). We do that to enable operations such as find with
* args which are const. * args which are const.
*/ */
typedef typename std::conditional< using const_range_type = typename std::conditional<
std::is_same<Iter, char*>::value || std::is_same<Iter, char*>::value ||
std::is_same<Iter, unsigned char*>::value, std::is_same<Iter, unsigned char*>::value,
Range<const value_type*>, Range<const value_type*>,
Range<Iter>>::type const_range_type; Range<Iter>>::type;
typedef std::char_traits<typename std::remove_const<value_type>::type> using traits_type =
traits_type; std::char_traits<typename std::remove_const<value_type>::type>;
static const size_type npos; static const size_type npos;
...@@ -1134,10 +1134,10 @@ constexpr Range<T const*> crange(std::array<T, n> const& array) { ...@@ -1134,10 +1134,10 @@ constexpr Range<T const*> crange(std::array<T, n> const& array) {
return Range<T const*>{array}; return Range<T const*>{array};
} }
typedef Range<const char*> StringPiece; using StringPiece = Range<const char*>;
typedef Range<char*> MutableStringPiece; using MutableStringPiece = Range<char*>;
typedef Range<const unsigned char*> ByteRange; using ByteRange = Range<const unsigned char*>;
typedef Range<unsigned char*> MutableByteRange; using MutableByteRange = Range<unsigned char*>;
template <class C> template <class C>
std::basic_ostream<C>& operator<<( std::basic_ostream<C>& operator<<(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment