CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::UnaryCompare_f< BinaryCompare > Class Template Reference

#include <definitions.hh>

Detailed Description

template<typename BinaryCompare>
class CASM::UnaryCompare_f< BinaryCompare >

For any binary functor class that accepts two arguments, such as an equals or compare functor, create a unary functor that stores a reference to the LHS value, and a reference to the binary functor, which then only needs to be provided the RHS value. This is useful for cases where one wants to use a binary functor in the context of something like std::find_if

Example: UnaryCompare_f<BinaryCompare_f> equals_target_element(target_element,args,for,binary,comapre); std::find_if(v.begin(),v.end(),equals_target_element);

Definition at line 59 of file definitions.hh.

Public Types

using argument_type = notstd::first_argument_type< BinaryCompare >
 

Public Member Functions

template<typename... CompareArgs>
 UnaryCompare_f (const argument_type &lhs, const CompareArgs &... args)
 
bool operator() (const argument_type &rhs)
 

Private Attributes

const argument_typem_lhs
 
const BinaryCompare m_compare_method
 

Member Typedef Documentation

◆ argument_type

template<typename BinaryCompare >
using CASM::UnaryCompare_f< BinaryCompare >::argument_type = notstd::first_argument_type<BinaryCompare>

Definition at line 61 of file definitions.hh.

Constructor & Destructor Documentation

◆ UnaryCompare_f()

template<typename BinaryCompare >
template<typename... CompareArgs>
CASM::UnaryCompare_f< BinaryCompare >::UnaryCompare_f ( const argument_type lhs,
const CompareArgs &...  args 
)
inline

Definition at line 64 of file definitions.hh.

Member Function Documentation

◆ operator()()

template<typename BinaryCompare >
bool CASM::UnaryCompare_f< BinaryCompare >::operator() ( const argument_type rhs)
inline

Definition at line 67 of file definitions.hh.

Member Data Documentation

◆ m_compare_method

template<typename BinaryCompare >
const BinaryCompare CASM::UnaryCompare_f< BinaryCompare >::m_compare_method
private

Definition at line 75 of file definitions.hh.

◆ m_lhs

template<typename BinaryCompare >
const argument_type& CASM::UnaryCompare_f< BinaryCompare >::m_lhs
private

Definition at line 74 of file definitions.hh.


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