Belle II Software  release-06-01-15
Common< AFunctor > Struct Template Reference

Adapter of a category function to find the common category of several objects. More...

#include <Common.h>

Public Member Functions

template<class Ts , class Category = decltype(m_functor(*std::declval<Ts>().begin()))>
boost::optional< Category > operator() (const Ts &ts) const
 Returns the common category value of a range. More...
 
template<class T1 , class T2 , class Category = decltype(m_functor(std::declval<T1>()))>
boost::optional< Category > operator() (const T1 &t1, const T2 &t2) const
 Returns the common category of two values. More...
 

Private Attributes

AFunctor m_functor
 Memory for the nested functor.
 

Detailed Description

template<class AFunctor>
struct Belle2::TrackFindingCDC::Common< AFunctor >

Adapter of a category function to find the common category of several objects.

Definition at line 21 of file Common.h.

Member Function Documentation

◆ operator()() [1/2]

boost::optional<Category> operator() ( const T1 &  t1,
const T2 &  t2 
) const
inline

Returns the common category of two values.

In case the category value differ between the values return empty optional

Definition at line 52 of file Common.h.

53  {
54  Category cat1 = m_functor(t1);
55  Category cat2 = m_functor(t2);
56  if (cat1 == cat2) return {cat1};
57  return {};
58  }
AFunctor m_functor
Memory for the nested functor.
Definition: Common.h:25

◆ operator()() [2/2]

boost::optional<Category> operator() ( const Ts &  ts) const
inline

Returns the common category value of a range.

In case the category value differ between the values return empty optional.

Definition at line 34 of file Common.h.


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