Boost logo

Boost Users :

From: chun ping wang (cablepuff_at_[hidden])
Date: 2007-10-12 20:22:27


So given this header.

template <
          QSTYPE type,
          typename T,
          template <typename ELEM, typename = std::allocator<ELEM> >
          class CONT
>
    CONT<T> quicksort(CONT<T>);

// inside the main file.
// I decided a function that takes vector of integer and returns a vector of
integer.
typedef boost::function<std::vector<int>(std::vector<int>)> sortfunc;
// create a function list to hold the sorting function.
// bunch of number include.
#include <boost/assign/std/vector.hpp>
std::vector<sortfunc> function_list;

using boost::assign::operator+=;
std::vector<sortfunc> function_list;
    // quicksort random
    function_list += (&algocpw::quicksort<algocpw::QSTYPE(algocpw::RANDOM),
int, std::vector>),
    // quicksort median
    (&algocpw::quicksort<algocpw::QSTYPE(algocpw::MEDIAN), int,
std::vector>),
    // quicksort mediantriple
    (&algocpw::quicksort<algocpw::QSTYPE(algocpw::MEDIANTRIPLE), int,
std::vector>),
    // merge sort
    (&algocpw::mergesort<int, std::vector>),
    // heap sort
    (&algocpw::heapsort<int, std::vector>),
    // selection sort
    (&algocpw::selection_sort<int, std::vector>),
    // standard sort
    (&algocpw::standard_sort<int, std::vector>);

I get the following errors.

./cs512/c++/sortingMain.cpp(63) : error C2896:
'boost::assign::list_inserter<boost::assign_detail::call_push_back<std::vector<_Ty,_Alloc>>,V>
boost::assign::operator +=(std::vector<_Ty,_Alloc> &,V2)' : cannot use
function template 'CONT<T> algocpw::mergesort(CONT<T>)' as a function
argument
        c:\cpw\msvc\cs512\c++\def\../sortingAlgo.hpp(32) : see declaration
of 'algocpw::mergesort'
./cs512/c++/sortingMain.cpp(63) : error C2784:
'boost::assign::list_inserter<boost::assign_detail::call_push_back<std::deque<T,Allocator>>,V>
boost::assign::operator +=(std::deque<T,Allocator> &,V2)' : could not deduce
template argument for 'std::deque<T,Allocator> &' from 'std::vector<_Ty>'
        with
        [
            _Ty=sortfunc
        ]

Where did "deque" come from.. i never included deque.



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