Molassembler  3.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Scine::Molassembler::Temple::Binding< T > Struct Template Reference

Type that will own rvalues, reference lvalues. More...

#include <Binding.h>

Inheritance diagram for Scine::Molassembler::Temple::Binding< T >:

Public Types

using type = std::conditional_t< std::is_rvalue_reference< T && >::value||std::is_fundamental< std::decay_t< T >>::value, std::decay_t< T >, const T & >
 

Public Member Functions

constexpr Binding (T &&t) noexcept
 

Data Fields

type value
 

Detailed Description

template<typename T>
struct Scine::Molassembler::Temple::Binding< T >

Type that will own rvalues, reference lvalues.

Template Parameters
TType to conditionally bind

In some situations, templated arguments need to be owned by the recipient. For instance, if you want to create a new range from some container, the handling of whether the container being modified is owned by the new range is very important to avoid both extraneous copies and dangling references.

We have to differentiate between rvalue and lvalue reference arguments to the adaptor constructor. Any rvalues have to be owned by the range being constructed, while any lvalues should be bound to a (const) reference.

This class makes handling that stuff a little easier by providing a single constructor that takes care of all cases.

You can also just use this class as a metafunction (see type).


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