The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::ptr_to_const_obj_ptr< T, ConstT > Struct Template Reference

Template type helper that removes a pointer, adds a const, and then re-adds the pointer. This is useful to turn "T" [T=U*] into "U const *" in places where simply using "const T" results in "U* const". More...

#include <Utils.hpp>

Public Types

typedef ConstT type
 

Detailed Description

template<typename T, typename ConstT = typename std::add_pointer< typename std::add_const< typename std::remove_pointer<T>::type >::type >::type>
struct sparta::ptr_to_const_obj_ptr< T, ConstT >

Template type helper that removes a pointer, adds a const, and then re-adds the pointer. This is useful to turn "T" [T=U*] into "U const *" in places where simply using "const T" results in "U* const".

Template Parameters
TType of object to use. Must be a pointer, typically with only one level (i.e. "U*", not "U**").
ConstTThe const object pointer type derived from T. Do not set. Use the default value instead

Example:

typedef ptr_to_const_obj_ptr<T>::type ConstType;

or

template <typename T,
typename ConstT=typename ptr_to_const_obj_ptr<T>::type>
struct S {
ConstT getConstT() const { ... }
};

Definition at line 129 of file Utils.hpp.

Member Typedef Documentation

◆ type

template<typename T , typename ConstT = typename std::add_pointer< typename std::add_const< typename std::remove_pointer<T>::type >::type >::type>
typedef ConstT sparta::ptr_to_const_obj_ptr< T, ConstT >::type

Definition at line 130 of file Utils.hpp.


The documentation for this struct was generated from the following file: