C++ Mathematical Expression Toolkit (ExprTk) release
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
exprtk::rtl::vecops::shift_right< T > Class Template Reference

#include <exprtk.hpp>

Inheritance diagram for exprtk::rtl::vecops::shift_right< T >:
[legend]
Collaboration diagram for exprtk::rtl::vecops::shift_right< T >:
[legend]

Public Types

typedef exprtk::igeneric_function< T > igfun_t
 
typedef igfun_t::parameter_list_t parameter_list_t
 
typedef igfun_t::generic_type generic_type
 
typedef generic_type::scalar_view scalar_t
 
typedef generic_type::vector_view vector_t
 
- Public Types inherited from exprtk::igeneric_function< T >
enum  return_type { e_rtrn_scalar = 0 , e_rtrn_string = 1 , e_rtrn_overload = 2 }
 
typedef T type
 
typedef type_store< T > generic_type
 
typedef generic_type::parameter_list parameter_list_t
 

Public Member Functions

 shift_right ()
 
operator() (const std::size_t &ps_index, parameter_list_t parameters)
 
- Public Member Functions inherited from exprtk::igeneric_function< T >
 igeneric_function (const std::string &param_seq="", const return_type rtr_type=e_rtrn_scalar)
 
virtual ~igeneric_function ()
 
virtual T operator() (parameter_list_t)
 
virtual T operator() (std::string &, parameter_list_t)
 
virtual T operator() (const std::size_t &, std::string &, parameter_list_t)
 
- Public Member Functions inherited from exprtk::function_traits
 function_traits ()
 
bool & allow_zero_parameters ()
 
bool & has_side_effects ()
 
std::size_t & min_num_args ()
 
std::size_t & max_num_args ()
 

Additional Inherited Members

- Public Attributes inherited from exprtk::igeneric_function< T >
std::string parameter_sequence
 
return_type rtrn_type
 

Detailed Description

template<typename T>
class exprtk::rtl::vecops::shift_right< T >

Definition at line 44833 of file exprtk.hpp.

Member Typedef Documentation

◆ generic_type

template<typename T >
typedef igfun_t::generic_type exprtk::rtl::vecops::shift_right< T >::generic_type

Definition at line 44839 of file exprtk.hpp.

◆ igfun_t

template<typename T >
typedef exprtk::igeneric_function<T> exprtk::rtl::vecops::shift_right< T >::igfun_t

Definition at line 44837 of file exprtk.hpp.

◆ parameter_list_t

template<typename T >
typedef igfun_t::parameter_list_t exprtk::rtl::vecops::shift_right< T >::parameter_list_t

Definition at line 44838 of file exprtk.hpp.

◆ scalar_t

template<typename T >
typedef generic_type::scalar_view exprtk::rtl::vecops::shift_right< T >::scalar_t

Definition at line 44840 of file exprtk.hpp.

◆ vector_t

template<typename T >
typedef generic_type::vector_view exprtk::rtl::vecops::shift_right< T >::vector_t

Definition at line 44841 of file exprtk.hpp.

Constructor & Destructor Documentation

◆ shift_right()

template<typename T >
exprtk::rtl::vecops::shift_right< T >::shift_right ( )
inline

Definition at line 44845 of file exprtk.hpp.

44846 : exprtk::igeneric_function<T>("VT|VTTT")
44847 /*
44848 Overloads:
44849 0. VT - vector, N
44850 1. VTTT - vector, N, r0, r1
44851 */
44852 {}

Member Function Documentation

◆ operator()()

template<typename T >
T exprtk::rtl::vecops::shift_right< T >::operator() ( const std::size_t &  ps_index,
parameter_list_t  parameters 
)
inlinevirtual

Reimplemented from exprtk::igeneric_function< T >.

Definition at line 44854 of file exprtk.hpp.

44855 {
44856 vector_t vec(parameters[0]);
44857
44858 std::size_t n = 0;
44859 std::size_t r0 = 0;
44860 std::size_t r1 = vec.size() - 1;
44861
44862 if (!scalar_t(parameters[1]).to_uint(n))
44863 return T(0);
44864
44865 if (
44866 (1 == ps_index) &&
44867 !helper::load_vector_range<T>::process(parameters, r0, r1, 2, 3, 0)
44868 )
44869 return T(0);
44870
44871 const std::size_t dist = r1 - r0 + 1;
44872
44873 if (n > dist)
44874 return T(0);
44875
44876 const std::size_t shift = (dist - (n % dist)) % dist;
44877
44878 std::rotate(
44879 vec.begin() + r0,
44880 vec.begin() + r0 + shift,
44881 vec.begin() + r1 + 1);
44882
44883 for (std::size_t i = r0; i < r0 + n; ++i)
44884 {
44885 vec[i] = T(0);
44886 }
44887
44888 return T(1);
44889 }
generic_type::vector_view vector_t
Definition exprtk.hpp:44841
generic_type::scalar_view scalar_t
Definition exprtk.hpp:44840
static bool process(parameter_list_t &parameters, std::size_t &r0, std::size_t &r1, const std::size_t &r0_prmidx, const std::size_t &r1_prmidx, const std::size_t vec_idx=0)
Definition exprtk.hpp:44231

References exprtk::type_store< T >::type_view< ViewType >::begin(), and exprtk::type_store< T >::type_view< ViewType >::size().

Here is the call graph for this function:

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