functor


a functor, or function object, is a cl-ss in c++ with the () operator overloaded. functors are used a lot in the standard library to do custom comparisons. they’re used in place of function pointers because sometimes you need to store a value or remember something (ie. put the functor into a special ‘state’ for whatever purpose), a functor can do this, a function pointer can’t (without messing with global variables).
cl-ss over5 { // this cl-ss is the functor
bool operator() (int x) {
return x > 5;
}
};

std::list l;

… // put a bunch of ints onto the list

over5 o5;
std::find_if(l.begin(), l.end(), o5);

// o5 will have its overloaded () operator called to check if the element in l is over 5.

Read Also:

  • Sicily

    an autonomous region of italy. sicilians have a rich culture, with greek, arab, spanish influence. they’re a fiercely proud people and offer some of the best foods you’ll ever eat. the women are beautiful and tough. also the origin of the mafia. you don’t want to mess with them — they’re from sicily. sicily is […]

  • funct

    antonym of defunct; probably shortened from functional when i reopened my website, it became funct again.

  • 9th base

    fingering a girl with one’s big toe “yeeeeah, my big toe got to 9th base last night!” folicular s-x, or s-x with hair follicles. warning this can cause severe bleeding. mike: oh my justin! did you hear, josh and jessie got to 9th base last week! tim:holy sh-t, that’s why she hasn’t been at work […]

  • Side pitter

    a mosh pitter or hardcore dancer who stands at the edge of the pit moving a little and wants to dance, but is too much of a pansy to actually go in the pit. hxc dancer 1- dude that kid in the haste the day tee shirt is into the music and is moving, why […]

  • Laxident

    an accident caused during a game, practice, or session of lacrosse chris had a laxident when he tripped on a stick left on the field. the action of throwing and breaking something in your home, apartment, or fraternity house, with a lacrosse ball i was laxin in the hall and had a laxident when the […]


Disclaimer: functor definition / meaning should not be considered complete, up to date, and is not intended to be used in place of a visit, consultation, or advice of a legal, medical, or any other professional. All content on this website is for informational purposes only.