Vcsn  2.2
Be Rational
vcsn::weightset_mixin< WeightSet > Struct Template Reference

Provide a variadic mul on top of a binary mul(), and one(). More...

#include <fwd.hh>

Inheritance diagram for vcsn::weightset_mixin< WeightSet >:
Collaboration diagram for vcsn::weightset_mixin< WeightSet >:

Public Types

using super_t = WeightSet
 

Public Member Functions

template<typename... Ts>
value_t mul (const Ts &...ts) const
 A variadic multiplication. More...
 
value_t power (value_t e, unsigned n) const
 Repeated multiplication. More...
 

Private Types

template<typename T >
using power_t = decltype(std::declval< T >().power(std::declval< typename T::value_t >(), 0))
 The signature of power. More...
 
template<typename T >
using has_power_mem_fn = detail::detect< T, power_t >
 Whether T features a power member function. More...
 

Private Member Functions

template<typename WS = super_t>
auto power_ (value_t e, unsigned n) const -> std::enable_if_t< has_power_mem_fn< WS >
 Case where the weightset T features a power(value_t, unsigned) member function. More...
 
template<typename WS = super_t>
auto power_ (value_t e, unsigned n) const -> std::enable_if_t<!has_power_mem_fn< WS >
 Case where the weightset T does not feature a power(value_t, unsigned) member function. More...
 
 if (!super_t::is_one(e)) while(n--) res
 

Private Attributes

 value_t
 
return res
 

Detailed Description

template<typename WeightSet>
struct vcsn::weightset_mixin< WeightSet >

Provide a variadic mul on top of a binary mul(), and one().

Definition at line 46 of file fwd.hh.

Member Typedef Documentation

template<typename WeightSet>
template<typename T >
using vcsn::weightset_mixin< WeightSet >::has_power_mem_fn = detail::detect<T, power_t>
private

Whether T features a power member function.

Definition at line 56 of file weightset.hh.

template<typename WeightSet>
template<typename T >
using vcsn::weightset_mixin< WeightSet >::power_t = decltype(std::declval<T>() .power(std::declval<typename T::value_t>(), 0))
private

The signature of power.

Definition at line 52 of file weightset.hh.

template<typename WeightSet>
using vcsn::weightset_mixin< WeightSet >::super_t = WeightSet

Definition at line 25 of file weightset.hh.

Member Function Documentation

template<typename WeightSet>
vcsn::weightset_mixin< WeightSet >::if ( !super_t::  is_onee)
private
template<typename WeightSet>
template<typename... Ts>
value_t vcsn::weightset_mixin< WeightSet >::mul ( const Ts &...  ts) const
inline
template<typename WeightSet>
value_t vcsn::weightset_mixin< WeightSet >::power ( value_t  e,
unsigned  n 
) const
inline

Repeated multiplication.

Definition at line 83 of file weightset.hh.

template<typename WeightSet>
template<typename WS = super_t>
auto vcsn::weightset_mixin< WeightSet >::power_ ( value_t  e,
unsigned  n 
) const -> std::enable_if_t<has_power_mem_fn<WS>
inlineprivate

Case where the weightset T features a power(value_t, unsigned) member function.

Definition at line 61 of file weightset.hh.

template<typename WeightSet>
template<typename WS = super_t>
auto vcsn::weightset_mixin< WeightSet >::power_ ( value_t  e,
unsigned  n 
) const -> std::enable_if_t<!has_power_mem_fn<WS>
inlineprivate

Case where the weightset T does not feature a power(value_t, unsigned) member function.

Definition at line 70 of file weightset.hh.

Member Data Documentation

template<typename WeightSet>
return vcsn::weightset_mixin< WeightSet >::res
private
template<typename WeightSet>
vcsn::weightset_mixin< WeightSet >::value_t
private
Initial value:
{
return super_t::power(e, n)

Definition at line 63 of file weightset.hh.

Referenced by vcsn::weightset_mixin< context< stateset_t, weightset_t >, Kind >::mul().


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