From: Warren Young Date: August 17 2008 12:22pm Subject: Re: A way to copy mysqlpp::StoreQueryResult into a std::map? List-Archive: http://lists.mysql.com/plusplus/7884 Message-Id: <2A8A08CA-8E44-496D-8C52-D966E2A0190C@etr-usa.com> MIME-Version: 1.0 (Apple Message framework v928.1) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Aug 17, 2008, at 4:09 AM, Alex wrote: >> From looking at the example, it seems I have to use classes/structs >> to copy > the data into a map. Is this correct? Or, can I just use a simple > function, > or something? The construct is called a functor: http://en.wikipedia.org/wiki/Function_object Functors have several advantages over function pointers, which is why they're used throughout STL. This feature of MySQL++ is modeled on STL algorithms like find_if(). It's true, they're rather heavy on the syntactic noise. If C++ supported anonymous (lambda) functions, we'd use them instead in places like this, but it doesn't, so we use functors.