Boost logo

Boost Users :

Subject: Re: [Boost-users] [array][bind] Binding boost array to a boost function
From: michi7x7 (mailing-lists_at_[hidden])
Date: 2010-10-11 10:48:00


  Am 11.10.2010 01:59, schrieb Ryan McConnehey:
> Is what I'm attempting possible?
>
> Ryan
>
Hi,

yes it is, but you need to pass the template-parameters:

Sorter<int, 8> shell(boost::bind(quicksort<int, 8>, _1));

or simply

Sorter<int, 8> shell(quicksort<int,8>);

Regards,

michi7x7
>
> template<typename T, std::size_t U>
> class Sorter
> {
> private:
> typedef boost::function<void(boost::array<T, U> & a)> t_SortFunction;
>
> t_SortFunction m_SortFunction;
>
> public:
> Sorter(t_SortFunction func) : m_SortFunction(func) {}
>
> bool sort(boost::array<T, U> & a)
> {
> m_SortFunction(a);
> }
> };
>
> template<typename T, std::size_t U>
> void quicksort(boost::array<T, U> & a)
> {
> }
>
> int main(int argc, char* argv[])
> {
>
> Sorter shell(boost::bind(quicksort, _1));
>
> return 0;
> }
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net