The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Static Public Attributes | List of all members
utils::const_clone< D, S > Struct Template Reference

Helper struct to clone the constness of one type to another. More...

#include <const_clone.hpp>

Public Types

using type = utils::conditional_t< is_source_const, const D, D >
 The destination type, possibly const qualified. More...
 
using reference = utils::conditional_t< is_source_const, const D &, D & >
 A reference to the destination type, possibly const qualified. More...
 
using pointer = utils::conditional_t< is_source_const, const D *, D * >
 A pointer to the destination type, possibly const qualified. More...
 

Static Public Attributes

static const bool is_source_const
 

Detailed Description

template<typename D, typename S>
struct utils::const_clone< D, S >

Helper struct to clone the constness of one type to another.

Warning
It seems *this in a const member function is not a const object, use this, which is a pointer to a const object.
Template Parameters
DThe destination type, it should have no cv-qualifier and not be a pointer or reference.
SThe source type, this type may be a pointer or reference and obviously is allowed to have a cv-qualifier, although volatile has no effect.

Definition at line 38 of file const_clone.hpp.

Member Typedef Documentation

template<typename D, typename S>
using utils::const_clone< D, S >::pointer = utils::conditional_t<is_source_const, const D*, D*>

A pointer to the destination type, possibly const qualified.

Definition at line 57 of file const_clone.hpp.

template<typename D, typename S>
using utils::const_clone< D, S >::reference = utils::conditional_t<is_source_const, const D&, D&>

A reference to the destination type, possibly const qualified.

Definition at line 53 of file const_clone.hpp.

template<typename D, typename S>
using utils::const_clone< D, S >::type = utils::conditional_t<is_source_const, const D, D>

The destination type, possibly const qualified.

Definition at line 49 of file const_clone.hpp.

Member Data Documentation

template<typename D, typename S>
const bool utils::const_clone< D, S >::is_source_const
static
Initial value:

Definition at line 40 of file const_clone.hpp.


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