単純には、型I1, I2, Fのオブジェクトをそれぞれi1, i2, fとするとbool c = f(*i1, *i2)のような呼び出しが可能であることを表している。
例
#include <iostream>#include <concepts>#include <iterator>#include <vector>#include <memory>template<typenameI1,typenameI2,std::indirect_binary_predicate<I1,I2>F>voidf(constchar*nameI1,constchar*nameI2,constchar*nameF){std::cout<<nameI1<<" and "<<nameI2<<" is indirect_binary_predicate "<<nameF<<std::endl;}template<typenameI1,typenameI2,typenameF>voidf(constchar*nameI1,constchar*nameI2,constchar*nameF){std::cout<<nameI1<<" and "<<nameI2<<" is not indirect_binary_predicate "<<nameF<<std::endl;}usingF1=decltype([](constint&,double&)->bool{returntrue;});usingF2=decltype([](constint&,double&)->void{});intmain(){f<int*,double*,F1>("int*","double*","int(const int&, double&)");f<std::unique_ptr<int>,double*,F1>("std::unique_ptr<int>","double*","int(const int&, double&)");f<std::vector<int>::iterator,double*,F1>("std::vector<int>::iterator","double*","int(const int&, double&)");f<std::istream_iterator<int>,double*,F1>("std::istream_iterator<int>","double*","int(const int&, double&)");std::cout<<"\n";f<int*,double*,F2>("int*","double*","int(const int&, double&)");f<std::unique_ptr<int>,double*,F2>("std::unique_ptr<int>","double*","int(const int&, double&)");f<std::vector<int>::iterator,double*,F2>("std::vector<int>::iterator","double*","int(const int&, double&)");f<std::istream_iterator<int>,double*,F2>("std::istream_iterator<int>","double*","int(const int&, double&)");}
出力
int* and double* is indirect_binary_predicate int(const int&, double&)
std::unique_ptr<int> and double* is indirect_binary_predicate int(const int&, double&)
std::vector<int>::iterator and double* is indirect_binary_predicate int(const int&, double&)
std::istream_iterator<int> and double* is indirect_binary_predicate int(const int&, double&)
int* and double* is not indirect_binary_predicate int(const int&, double&)
std::unique_ptr<int> and double* is not indirect_binary_predicate int(const int&, double&)
std::vector<int>::iterator and double* is not indirect_binary_predicate int(const int&, double&)
std::istream_iterator<int> and double* is not indirect_binary_predicate int(const int&, double&)
You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.