Classes | Typedefs | Functions
PLMD::wrapper Namespace Reference

We use a separate namespace here instead of hiding these classes in the Plumed class, because some of these structs might be specialized by the user. More...

Classes

struct  has_size_and_data
 Primary template, assumes T does not have both size() and data() methods. More...
 
struct  has_size_and_data< T, void_t< decltype(std::declval< T >().size()), decltype(std::declval< T >().data())> >
 Specialization for types T that do have both size() and data() methods. More...
 
struct  is_custom_array
 Primary template, assumes T is not a custom structure. More...
 
struct  is_custom_array< std::array< T, N > >
 Template specialization for std::array. More...
 
struct  is_custom_array< T[N]>
 Template specialization for C arrays. More...
 
struct  make_void
 This is to replace c++17 std::void_t. More...
 

Typedefs

template<typename... Ts>
using void_t = typename make_void< Ts... >::type
 

Functions

template<typename T , typename std::enable_if< wrapper::is_custom_array< typename std::remove_reference< T >::type >::value, int >::type = 0>
wrapper::is_custom_array< T >::value_type * custom_array_cast (T *val)
 Cast a pointer to a custom_array to a pointer of its value_type. More...
 
template<typename T , typename std::enable_if< wrapper::is_custom_array< typename std::remove_reference< T >::type >::value, int >::type = 0>
std::size_t custom_array_size ()
 Report the size of a custom_array. More...
 
template<>
std::size_t size (const std::string &obj)
 Specialization for std::string, which returns size()+1, which includes the terminating null character. More...
 
template<typename T >
std::size_t size (const T &obj)
 Generic utility to retrieve the size of a container. More...
 

Detailed Description

We use a separate namespace here instead of hiding these classes in the Plumed class, because some of these structs might be specialized by the user.

Typedef Documentation

◆ void_t

template<typename... Ts>
using PLMD::wrapper::void_t = typedef typename make_void<Ts...>::type

Function Documentation

◆ custom_array_cast()

template<typename T , typename std::enable_if< wrapper::is_custom_array< typename std::remove_reference< T >::type >::value, int >::type = 0>
wrapper::is_custom_array<T>::value_type* PLMD::wrapper::custom_array_cast ( T *  val)
inline

Cast a pointer to a custom_array to a pointer of its value_type.

typename std::remove_reference<T>::type is needed because C arrays are passed by reference

◆ custom_array_size()

template<typename T , typename std::enable_if< wrapper::is_custom_array< typename std::remove_reference< T >::type >::value, int >::type = 0>
std::size_t PLMD::wrapper::custom_array_size ( )
inline

Report the size of a custom_array.

typename std::remove_reference<T>::type is needed because C arrays are passed by reference

◆ size() [1/2]

template<>
std::size_t PLMD::wrapper::size ( const std::string &  obj)
inline

Specialization for std::string, which returns size()+1, which includes the terminating null character.

◆ size() [2/2]

template<typename T >
std::size_t PLMD::wrapper::size ( const T &  obj)
inline

Generic utility to retrieve the size of a container.