ATLAS Offline Software
Public Types | Public Member Functions | List of all members
CxxUtils::range_with_conv< RANGE > Class Template Reference

Add to a range class conversions to containers. More...

#include <range_with_conv.h>

Inheritance diagram for CxxUtils::range_with_conv< RANGE >:
Collaboration diagram for CxxUtils::range_with_conv< RANGE >:

Public Types

using Elt_t = std::ranges::range_value_t< RANGE >
 

Public Member Functions

template<template< class, class > class CONT, class ALLOC >
 operator CONT< Elt_t, ALLOC > () const
 Implicit conversion of the range to a container. More...
 
std::vector< Elt_tasVector () const
 Explicit conversion to a vector. More...
 

Detailed Description

template<class RANGE>
class CxxUtils::range_with_conv< RANGE >

Add to a range class conversions to containers.

Many standard range objects allow operator[] but do not implement at(). Use this to add at() methods to a random_access_range class.

Definition at line 31 of file range_with_conv.h.

Member Typedef Documentation

◆ Elt_t

template<class RANGE >
using CxxUtils::range_with_conv< RANGE >::Elt_t = std::ranges::range_value_t<RANGE>

Definition at line 36 of file range_with_conv.h.

Member Function Documentation

◆ asVector()

template<class RANGE >
std::vector<Elt_t> CxxUtils::range_with_conv< RANGE >::asVector ( ) const
inline

Explicit conversion to a vector.

For use from Python.

Definition at line 52 of file range_with_conv.h.

53  {
54  return *this;
55  }

◆ operator CONT< Elt_t, ALLOC >()

template<class RANGE >
template<template< class, class > class CONT, class ALLOC >
CxxUtils::range_with_conv< RANGE >::operator CONT< Elt_t, ALLOC > ( ) const
inline

Implicit conversion of the range to a container.

Definition at line 43 of file range_with_conv.h.

44  {
45  return CONT<Elt_t, ALLOC> (this->begin(), this->end());
46  }

The documentation for this class was generated from the following file:
CxxUtils::end
auto end(range_with_at< T > &s)
Definition: range_with_at.h:68
CxxUtils::begin
auto begin(range_with_at< T > &s)
Definition: range_with_at.h:64