Skip to content

Commit 9734635

Browse files
authored
Modernize the code (#19)
1 parent f2a3bdd commit 9734635

File tree

13 files changed

+43
-51
lines changed

13 files changed

+43
-51
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,6 @@ jobs:
4141
linkflags: "linkflags=--coverage -lasan -lubsan"
4242
gcov_tool: "gcov-10"
4343
launcher: "testing.launcher=LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.6"
44-
- toolset: gcc-9
45-
cxxstd: "03,11,14,17,2a"
46-
os: ubuntu-22.04
47-
cxxflags: "cxxflags=--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined"
48-
linkflags: "linkflags=--coverage -lasan -lubsan"
49-
gcov_tool: "gcov-9"
50-
launcher: "testing.launcher=LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.5"
5144
- toolset: clang
5245
compiler: clang++-14
5346
cxxstd: "03,11,14,17,2a"

doc/Jamfile.v2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ boostbook standalone
3131
:
3232
type_index
3333
:
34-
<xsl:param>boost.root=http://www.boost.org/doc/libs/1_53_0
34+
<xsl:param>boost.root=http://www.boost.org/doc/libs/1_90_0
3535
# <xsl:param>boost.root=../../../..
3636
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html
3737
;

examples/user_defined_typeinfo.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ namespace my_namespace {
2323
class my_class;
2424
struct my_struct;
2525

26-
typedef std::vector<my_class> my_classes;
27-
typedef std::string my_string;
26+
using my_classes = std::vector<my_class>;
27+
using my_string = std::string;
2828

2929
} // namespace my_namespace
3030

@@ -96,21 +96,21 @@ class my_type_index: public boost::typeindex::type_index_facade<my_type_index, d
9696
const detail::my_typeinfo* data_;
9797

9898
public:
99-
typedef detail::my_typeinfo type_info_t;
99+
using type_info_t = detail::my_typeinfo;
100100

101-
inline my_type_index() BOOST_NOEXCEPT
101+
inline my_type_index() noexcept
102102
: data_(&detail::my_typeinfo_construct<void>())
103103
{}
104104

105-
inline my_type_index(const type_info_t& data) BOOST_NOEXCEPT
105+
inline my_type_index(const type_info_t& data) noexcept
106106
: data_(&data)
107107
{}
108108

109-
inline const type_info_t& type_info() const BOOST_NOEXCEPT {
109+
inline const type_info_t& type_info() const noexcept {
110110
return *data_;
111111
}
112112

113-
inline const char* raw_name() const BOOST_NOEXCEPT {
113+
inline const char* raw_name() const noexcept {
114114
return data_->type_;
115115
}
116116

@@ -119,17 +119,17 @@ class my_type_index: public boost::typeindex::type_index_facade<my_type_index, d
119119
}
120120

121121
template <class T>
122-
inline static my_type_index type_id() BOOST_NOEXCEPT {
122+
inline static my_type_index type_id() noexcept {
123123
return detail::my_typeinfo_construct<T>();
124124
}
125125

126126
template <class T>
127-
inline static my_type_index type_id_with_cvr() BOOST_NOEXCEPT {
127+
inline static my_type_index type_id_with_cvr() noexcept {
128128
return detail::my_typeinfo_construct<T>();
129129
}
130130

131131
template <class T>
132-
inline static my_type_index type_id_runtime(const T& variable) BOOST_NOEXCEPT;
132+
inline static my_type_index type_id_runtime(const T& variable) noexcept;
133133
};
134134

135135
} // namespace my_namespace
@@ -168,7 +168,7 @@ namespace my_namespace { namespace detail {
168168
*/
169169
namespace my_namespace {
170170
template <class T>
171-
my_type_index my_type_index::type_id_runtime(const T& variable) BOOST_NOEXCEPT {
171+
my_type_index my_type_index::type_id_runtime(const T& variable) noexcept {
172172
// Classes that were marked with `MY_TYPEINDEX_REGISTER_CLASS` will have a
173173
// `type_id_runtime()` method.
174174
return variable.type_id_runtime();
@@ -204,7 +204,7 @@ struct my_struct: public my_class {
204204
*/
205205
#define BOOST_TYPE_INDEX_REGISTER_CLASS MY_TYPEINDEX_REGISTER_CLASS
206206
namespace boost { namespace typeindex {
207-
typedef my_namespace::my_type_index type_index;
207+
using type_index = my_namespace::my_type_index;
208208
}}
209209
//] [/type_index_my_type_index_worldwide_typedefs]
210210

include/boost/type_index.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ BOOST_TYPE_INDEX_BEGIN_MODULE_EXPORT
129129
/// user defined type_index class.
130130
///
131131
/// \b See boost::typeindex::type_index_facade for a full description of type_index functions.
132-
typedef platform_specific type_index;
132+
using type_index = platform_specific;
133133
#elif defined(BOOST_TYPE_INDEX_USER_TYPEINDEX)
134134
// Nothing to do
135135
#elif (!defined(BOOST_NO_RTTI) && !defined(BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY)) || defined(BOOST_MSVC)
136-
typedef boost::typeindex::stl_type_index type_index;
136+
using type_index = boost::typeindex::stl_type_index;
137137
#else
138-
typedef boost::typeindex::ctti_type_index type_index;
138+
using type_index = boost::typeindex::ctti_type_index;
139139
#endif
140140

141141
/// Depending on a compiler flags, optimal implementation of type_info will be used
@@ -145,7 +145,7 @@ BOOST_TYPE_INDEX_BEGIN_MODULE_EXPORT
145145
/// some user defined class.
146146
///
147147
/// type_info \b is \b not copyable or default constructible. It is \b not assignable too!
148-
typedef type_index::type_info_t type_info;
148+
using type_info = type_index::type_info_t;
149149

150150
#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED)
151151

include/boost/type_index/ctti_type_index.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class ctti_type_index: public type_index_facade<ctti_type_index, detail::ctti_da
112112
{}
113113

114114
public:
115-
typedef detail::ctti_data type_info_t;
115+
using type_info_t = detail::ctti_data;
116116

117117
BOOST_CXX14_CONSTEXPR inline ctti_type_index() noexcept
118118
: data_(boost::detail::ctti<void>::n())
@@ -164,8 +164,8 @@ BOOST_CXX14_CONSTEXPR inline bool ctti_type_index::before(const ctti_type_index&
164164

165165
template <class T>
166166
BOOST_CXX14_CONSTEXPR inline ctti_type_index ctti_type_index::type_id() noexcept {
167-
typedef typename std::remove_reference<T>::type no_ref_t;
168-
typedef typename std::remove_cv<no_ref_t>::type no_cvr_t;
167+
using no_ref_t = typename std::remove_reference<T>::type;
168+
using no_cvr_t = typename std::remove_cv<no_ref_t>::type;
169169
return ctti_type_index(boost::detail::ctti<no_cvr_t>::n());
170170
}
171171

include/boost/type_index/detail/compile_time_type_info.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,25 +224,25 @@ constexpr ctti_skip skip() noexcept { return detail::make_ctti_skip(0, 0, ""); }
224224

225225
template <unsigned int... Left, unsigned int... Right>
226226
struct make_index_sequence_join<index_seq<Left...>, index_seq<Right...> > {
227-
typedef index_seq<Left..., Right...> type;
227+
using type = index_seq<Left..., Right...>;
228228
};
229229

230230
template <unsigned int C, unsigned int D>
231231
struct make_index_seq_impl {
232-
typedef typename make_index_sequence_join<
232+
using type = typename make_index_sequence_join<
233233
typename make_index_seq_impl<C, D / 2>::type,
234234
typename make_index_seq_impl<C + D / 2, (D + 1) / 2>::type
235-
>::type type;
235+
>::type;
236236
};
237237

238238
template <unsigned int C>
239239
struct make_index_seq_impl<C, 0> {
240-
typedef index_seq<> type;
240+
using type = index_seq<>;
241241
};
242242

243243
template <unsigned int C>
244244
struct make_index_seq_impl<C, 1> {
245-
typedef index_seq<C> type;
245+
using type = index_seq<C>;
246246
};
247247

248248
template <char... C>
@@ -315,10 +315,10 @@ struct ctti {
315315
>();
316316
static_assert(!boost::typeindex::detail::skip().until_runtime_length, "Skipping for GCC in C++14 mode is unsupported");
317317

318-
typedef typename boost::typeindex::detail::make_index_seq_impl<
318+
using idx_seq = typename boost::typeindex::detail::make_index_seq_impl<
319319
boost::typeindex::detail::skip().size_at_begin,
320320
size - sizeof("const *") + 1 - boost::typeindex::detail::skip().size_at_begin
321-
>::type idx_seq;
321+
>::type;
322322
return impl(idx_seq());
323323
}
324324
#else

include/boost/type_index/runtime_cast/pointer_cast.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ BOOST_TYPE_INDEX_BEGIN_MODULE_EXPORT
3535
/// an address suitably offset from u. If no such conversion exists, returns nullptr.
3636
template<typename T, typename U>
3737
T runtime_cast(U* u) noexcept {
38-
typedef typename std::remove_pointer<T>::type impl_type;
38+
using impl_type = typename std::remove_pointer<T>::type;
3939
return detail::runtime_cast_impl<impl_type>(u, std::is_base_of<T, U>());
4040
}
4141

@@ -46,7 +46,7 @@ T runtime_cast(U* u) noexcept {
4646
/// an address suitably offset from u. If no such conversion exists, returns nullptr.
4747
template<typename T, typename U>
4848
T runtime_cast(U const* u) noexcept {
49-
typedef typename std::remove_pointer<T>::type impl_type;
49+
using impl_type = typename std::remove_pointer<T>::type;
5050
return detail::runtime_cast_impl<impl_type>(u, std::is_base_of<T, U>());
5151
}
5252

include/boost/type_index/runtime_cast/reference_cast.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct BOOST_SYMBOL_VISIBLE bad_runtime_cast : std::exception
4646
/// suitably offset from u. If no such conversion exists, throws boost::typeindex::bad_runtime_cast.
4747
template<typename T, typename U>
4848
typename std::add_lvalue_reference<T>::type runtime_cast(U& u) {
49-
typedef typename std::remove_reference<T>::type impl_type;
49+
using impl_type = typename std::remove_reference<T>::type;
5050
impl_type* value = detail::runtime_cast_impl<impl_type>(
5151
std::addressof(u), std::is_base_of<T, U>());
5252
if(!value)
@@ -61,7 +61,7 @@ typename std::add_lvalue_reference<T>::type runtime_cast(U& u) {
6161
/// suitably offset from u. If no such conversion exists, throws boost::typeindex::bad_runtime_cast.
6262
template<typename T, typename U>
6363
typename std::add_lvalue_reference<const T>::type runtime_cast(U const& u) {
64-
typedef typename std::remove_reference<T>::type impl_type;
64+
using impl_type = typename std::remove_reference<T>::type;
6565
impl_type* value = detail::runtime_cast_impl<impl_type>(
6666
std::addressof(u), std::is_base_of<T, U>());
6767
if(!value)

include/boost/type_index/stl_type_index.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ class stl_type_index
117117
{
118118
public:
119119
#ifdef BOOST_NO_STD_TYPEINFO
120-
typedef type_info type_info_t;
120+
using type_info_t = type_info;
121121
#else
122-
typedef std::type_info type_info_t;
122+
using type_info_t = std::type_info;
123123
#endif
124124

125125
private:
@@ -175,7 +175,7 @@ inline const char* stl_type_index::name() const noexcept {
175175

176176
inline std::string stl_type_index::pretty_name() const {
177177
static const char cvr_saver_name[] = "boost::typeindex::detail::cvr_saver";
178-
static BOOST_CONSTEXPR_OR_CONST std::string::size_type cvr_saver_name_len = sizeof(cvr_saver_name) - 1;
178+
constexpr std::string::size_type cvr_saver_name_len = sizeof(cvr_saver_name) - 1;
179179

180180
// In case of MSVC demangle() is a no-op, and name() already returns demangled name.
181181
// In case of GCC and Clang (on non-Windows systems) name() returns mangled name and demangle() undecorates it.
@@ -270,8 +270,8 @@ inline bool stl_type_index::before(const stl_type_index& rhs) const noexcept {
270270

271271
template <class T>
272272
inline stl_type_index stl_type_index::type_id() noexcept {
273-
typedef typename std::remove_reference<T>::type no_ref_t;
274-
typedef typename std::remove_cv<no_ref_t>::type no_cvr_t;
273+
using no_ref_t = typename std::remove_reference<T>::type;
274+
using no_cvr_t = typename std::remove_cv<no_ref_t>::type;
275275
return typeid(no_cvr_t);
276276
}
277277

@@ -281,11 +281,11 @@ namespace detail {
281281

282282
template <class T>
283283
inline stl_type_index stl_type_index::type_id_with_cvr() noexcept {
284-
typedef typename std::conditional<
284+
using type = typename std::conditional<
285285
std::is_reference<T>::value || std::is_const<T>::value || std::is_volatile<T>::value,
286286
detail::cvr_saver<T>,
287287
T
288-
>::type type;
288+
>::type;
289289

290290
return typeid(type);
291291
}

include/boost/type_index/type_index_facade.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ BOOST_TYPE_INDEX_BEGIN_MODULE_EXPORT
4242
/// class stl_type_index: public type_index_facade<stl_type_index, std::type_info>
4343
/// {
4444
/// public:
45-
/// typedef std::type_info type_info_t;
45+
/// using type_info_t = std::type_info;
4646
/// private:
4747
/// const type_info_t* data_;
4848
///
@@ -70,7 +70,7 @@ class type_index_facade {
7070
}
7171
/// @endcond
7272
public:
73-
typedef TypeInfo type_info_t;
73+
using type_info_t = TypeInfo;
7474

7575
/// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw.
7676
/// \return Name of a type. By default returns Derived::raw_name().

0 commit comments

Comments
 (0)