@@ -70,14 +70,12 @@ namespace tl {
7070namespace detail {
7171template <class T >
7272struct is_trivially_copy_constructible : std::is_trivially_copy_constructible<T>
73- {
74- };
73+ {};
7574#ifdef _GLIBCXX_VECTOR
7675template <class T , class A >
7776struct is_trivially_copy_constructible <std::vector<T, A>>
7877 : std::is_trivially_copy_constructible<T>
79- {
80- };
78+ {};
8179#endif
8280}
8381}
@@ -147,17 +145,14 @@ using conditional_t = typename std::conditional<B, T, F>::type;
147145// std::conjunction from C++17
148146template <class ...>
149147struct conjunction : std::true_type
150- {
151- };
148+ {};
152149template <class B >
153150struct conjunction <B> : B
154- {
155- };
151+ {};
156152template <class B , class ... Bs>
157153struct conjunction <B, Bs...>
158154 : std::conditional<bool (B::value), conjunction<Bs...>, B>::type
159- {
160- };
155+ {};
161156
162157#if defined(_LIBCPP_VERSION) && __cplusplus == 201103L
163158#define TL_TRAITS_LIBCXX_MEM_FN_WORKAROUND
@@ -169,50 +164,40 @@ struct conjunction<B, Bs...>
169164#ifdef TL_TRAITS_LIBCXX_MEM_FN_WORKAROUND
170165template <class T >
171166struct is_pointer_to_non_const_member_func : std::false_type
172- {
173- };
167+ {};
174168template <class T , class Ret , class ... Args>
175169struct is_pointer_to_non_const_member_func <Ret (T::*)(Args...)> : std::true_type
176- {
177- };
170+ {};
178171template <class T , class Ret , class ... Args>
179172struct is_pointer_to_non_const_member_func <Ret (T::*)(Args...)&>
180173 : std::true_type
181- {
182- };
174+ {};
183175template <class T , class Ret , class ... Args>
184176struct is_pointer_to_non_const_member_func <Ret (T::*)(Args...) &&>
185177 : std::true_type
186- {
187- };
178+ {};
188179template <class T , class Ret , class ... Args>
189180struct is_pointer_to_non_const_member_func <Ret (T::*)(Args...) volatile >
190181 : std::true_type
191- {
192- };
182+ {};
193183template <class T , class Ret , class ... Args>
194184struct is_pointer_to_non_const_member_func <Ret (T::*)(Args...) volatile &>
195185 : std::true_type
196- {
197- };
186+ {};
198187template <class T , class Ret , class ... Args>
199188struct is_pointer_to_non_const_member_func <Ret (T::*)(Args...) volatile &&>
200189 : std::true_type
201- {
202- };
190+ {};
203191
204192template <class T >
205193struct is_const_or_const_ref : std::false_type
206- {
207- };
194+ {};
208195template <class T >
209196struct is_const_or_const_ref <T const &> : std::true_type
210- {
211- };
197+ {};
212198template <class T >
213199struct is_const_or_const_ref <T const > : std::true_type
214- {
215- };
200+ {};
216201#endif
217202
218203// std::invoke from C++17
@@ -269,13 +254,11 @@ using invoke_result_t = typename invoke_result<F, Us...>::type;
269254// TODO make a version which works with MSVC 2015
270255template <class T , class U = T>
271256struct is_swappable : std::true_type
272- {
273- };
257+ {};
274258
275259template <class T , class U = T>
276260struct is_nothrow_swappable : std::true_type
277- {
278- };
261+ {};
279262#else
280263// https://stackoverflow.com/questions/26744589/what-is-a-proper-way-to-implement-is-swappable-to-test-for-the-swappable-concept
281264namespace swap_adl_tests {
@@ -313,19 +296,16 @@ struct is_std_swap_noexcept
313296 : std::integral_constant<bool ,
314297 std::is_nothrow_move_constructible<T>::value &&
315298 std::is_nothrow_move_assignable<T>::value>
316- {
317- };
299+ {};
318300
319301template <class T , std::size_t N>
320302struct is_std_swap_noexcept <T[N]> : is_std_swap_noexcept<T>
321- {
322- };
303+ {};
323304
324305template <class T , class U >
325306struct is_adl_swap_noexcept
326307 : std::integral_constant<bool , noexcept (can_swap<T, U>(0 ))>
327- {
328- };
308+ {};
329309} // namespace swap_adl_tests
330310
331311template <class T , class U = T>
@@ -336,8 +316,7 @@ struct is_swappable
336316 (!decltype (detail::swap_adl_tests::uses_std<T, U>(0 ))::value ||
337317 (std::is_move_assignable<T>::value &&
338318 std::is_move_constructible<T>::value))>
339- {
340- };
319+ {};
341320
342321template <class T , std::size_t N>
343322struct is_swappable <T[N], T[N]>
@@ -346,8 +325,7 @@ struct is_swappable<T[N], T[N]>
346325 decltype (detail::swap_adl_tests::can_swap<T[N], T[N]>(0 ))::value &&
347326 (!decltype (detail::swap_adl_tests::uses_std<T[N], T[N]>(0 ))::value ||
348327 is_swappable<T, T>::value)>
349- {
350- };
328+ {};
351329
352330template <class T , class U = T>
353331struct is_nothrow_swappable
@@ -358,8 +336,7 @@ struct is_nothrow_swappable
358336 detail::swap_adl_tests::is_std_swap_noexcept<T>::value) ||
359337 (!decltype (detail::swap_adl_tests::uses_std<T, U>(0 ))::value &&
360338 detail::swap_adl_tests::is_adl_swap_noexcept<T, U>::value))>
361- {
362- };
339+ {};
363340#endif
364341#endif
365342
@@ -375,12 +352,10 @@ using void_t = typename voider<Ts...>::type;
375352// Trait for checking if a type is a tl::optional
376353template <class T >
377354struct is_optional_impl : std::false_type
378- {
379- };
355+ {};
380356template <class T >
381357struct is_optional_impl <optional<T>> : std::true_type
382- {
383- };
358+ {};
384359template <class T >
385360using is_optional = is_optional_impl<decay_t <T>>;
386361
@@ -397,8 +372,7 @@ struct returns_void_impl;
397372template <class F , class ... U>
398373struct returns_void_impl <F, void_t <invoke_result_t <F, U...>>, U...>
399374 : std::is_void<invoke_result_t <F, U...>>
400- {
401- };
375+ {};
402376template <class F , class ... U>
403377using returns_void = returns_void_impl<F, void , U...>;
404378
@@ -561,10 +535,7 @@ struct optional_operations_base : optional_storage_base<T>
561535 TL_OPTIONAL_11_CONSTEXPR const T& get () const & { return this ->m_value ; }
562536 TL_OPTIONAL_11_CONSTEXPR T&& get() && { return std::move (this ->m_value ); }
563537#ifndef TL_OPTIONAL_NO_CONSTRR
564- constexpr const T&& get() const &&
565- {
566- return std::move (this ->m_value );
567- }
538+ constexpr const T&& get() const && { return std::move (this ->m_value ); }
568539#endif
569540};
570541
@@ -1520,33 +1491,21 @@ class optional
15201491 }
15211492
15221493 // / Returns the stored value
1523- TL_OPTIONAL_11_CONSTEXPR T& operator *() &
1524- {
1525- return this ->m_value ;
1526- }
1494+ TL_OPTIONAL_11_CONSTEXPR T& operator *() & { return this ->m_value ; }
15271495
1528- constexpr const T& operator *() const &
1529- {
1530- return this ->m_value ;
1531- }
1496+ constexpr const T& operator *() const & { return this ->m_value ; }
15321497
15331498 TL_OPTIONAL_11_CONSTEXPR T&& operator *() &&
15341499 {
15351500 return std::move (this ->m_value );
15361501 }
15371502
15381503#ifndef TL_OPTIONAL_NO_CONSTRR
1539- constexpr const T&& operator *() const &&
1540- {
1541- return std::move (this ->m_value );
1542- }
1504+ constexpr const T&& operator *() const && { return std::move (this ->m_value ); }
15431505#endif
15441506
15451507 // / Returns whether or not the optional has a value
1546- constexpr bool has_value () const noexcept
1547- {
1548- return this ->m_has_value ;
1549- }
1508+ constexpr bool has_value () const noexcept { return this ->m_has_value ; }
15501509
15511510 constexpr explicit operator bool () const noexcept
15521511 {
@@ -2432,37 +2391,19 @@ class optional<T&>
24322391 return *this = std::forward<U>(u);
24332392 }
24342393
2435- void swap (optional& rhs) noexcept
2436- {
2437- std::swap (m_value, rhs.m_value );
2438- }
2394+ void swap (optional& rhs) noexcept { std::swap (m_value, rhs.m_value ); }
24392395
24402396 // / Returns a pointer to the stored value
2441- constexpr const T* operator ->() const noexcept
2442- {
2443- return m_value;
2444- }
2397+ constexpr const T* operator ->() const noexcept { return m_value; }
24452398
2446- TL_OPTIONAL_11_CONSTEXPR T* operator ->() noexcept
2447- {
2448- return m_value;
2449- }
2399+ TL_OPTIONAL_11_CONSTEXPR T* operator ->() noexcept { return m_value; }
24502400
24512401 // / Returns the stored value
2452- TL_OPTIONAL_11_CONSTEXPR T& operator *() noexcept
2453- {
2454- return *m_value;
2455- }
2402+ TL_OPTIONAL_11_CONSTEXPR T& operator *() noexcept { return *m_value; }
24562403
2457- constexpr const T& operator *() const noexcept
2458- {
2459- return *m_value;
2460- }
2404+ constexpr const T& operator *() const noexcept { return *m_value; }
24612405
2462- constexpr bool has_value () const noexcept
2463- {
2464- return m_value != nullptr ;
2465- }
2406+ constexpr bool has_value () const noexcept { return m_value != nullptr ; }
24662407
24672408 constexpr explicit operator bool () const noexcept
24682409 {
@@ -2505,10 +2446,7 @@ class optional<T&>
25052446 }
25062447
25072448 // / Destroys the stored value if one exists, making the optional empty
2508- void reset () noexcept
2509- {
2510- m_value = nullptr ;
2511- }
2449+ void reset () noexcept { m_value = nullptr ; }
25122450
25132451private:
25142452 T* m_value;
0 commit comments