mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
Use enable_if_t
This commit is contained in:
parent
350aaf4b7a
commit
848f1c3d6f
@ -8,7 +8,7 @@
|
|||||||
#include <map> // for map
|
#include <map> // for map
|
||||||
#include <memory> // for shared_ptr
|
#include <memory> // for shared_ptr
|
||||||
#include <string> // for string
|
#include <string> // for string
|
||||||
#include <type_traits> // for declval, enable_if, false_type, is_co...
|
#include <type_traits> // for declval, enable_if_t, false_type, is_co...
|
||||||
#include <typeinfo> // for type_info
|
#include <typeinfo> // for type_info
|
||||||
#include <utility> // for move, swap, pair
|
#include <utility> // for move, swap, pair
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
@ -39,7 +39,7 @@ namespace ngcore
|
|||||||
T* constructIfPossible_impl(Rest... /*unused*/)
|
T* constructIfPossible_impl(Rest... /*unused*/)
|
||||||
{ throw Exception(std::string(Demangle(typeid(T).name())) + " is not default constructible!"); }
|
{ throw Exception(std::string(Demangle(typeid(T).name())) + " is not default constructible!"); }
|
||||||
|
|
||||||
template<typename T, typename= typename std::enable_if<std::is_constructible<T>::value>::type>
|
template<typename T, typename= std::enable_if_t<std::is_constructible<T>::value>>
|
||||||
T* constructIfPossible_impl(int /*unused*/) { return new T; } // NOLINT
|
T* constructIfPossible_impl(int /*unused*/) { return new T; } // NOLINT
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -211,7 +211,7 @@ namespace ngcore
|
|||||||
|
|
||||||
// archive implementation for enums
|
// archive implementation for enums
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto operator & (T& val) -> typename std::enable_if<std::is_enum<T>::value, Archive&>::type
|
auto operator & (T& val) -> std::enable_if_t<std::is_enum<T>::value, Archive&>
|
||||||
{
|
{
|
||||||
int enumval;
|
int enumval;
|
||||||
if(Output())
|
if(Output())
|
||||||
@ -274,7 +274,7 @@ namespace ngcore
|
|||||||
}
|
}
|
||||||
// Archive arrays =====================================================
|
// Archive arrays =====================================================
|
||||||
// this functions can be overloaded in Archive implementations for more efficiency
|
// this functions can be overloaded in Archive implementations for more efficiency
|
||||||
template <typename T, typename = typename std::enable_if<is_archivable<T>>::type>
|
template <typename T, typename = std::enable_if_t<is_archivable<T>>>
|
||||||
Archive & Do (T * data, size_t n)
|
Archive & Do (T * data, size_t n)
|
||||||
{ for (size_t j = 0; j < n; j++) { (*this) & data[j]; }; return *this; }; // NOLINT
|
{ for (size_t j = 0; j < n; j++) { (*this) & data[j]; }; return *this; }; // NOLINT
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ namespace ngcore
|
|||||||
SymbolTable& operator=(SymbolTable<T>&&) = default;
|
SymbolTable& operator=(SymbolTable<T>&&) = default;
|
||||||
|
|
||||||
template<typename T2=T>
|
template<typename T2=T>
|
||||||
auto DoArchive(Archive& ar) -> typename std::enable_if<is_archivable<T2>, void>::type
|
auto DoArchive(Archive& ar) -> typename std::enable_if_t<is_archivable<T2>>
|
||||||
{
|
{
|
||||||
ar & names & data;
|
ar & names & data;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user