Thanks. For some reason this does not work.
template
<
class T,
template <
typename,
typename = boost::heap_clone_allocator,
typename = std::allocator<void*> >
class PTR_CONT
>
PTR_CONT<PTR_CONT<T> > getDataSet(const char* fileInputPath, boost::unordered_map<T, T>* pMap)
{
BOOST_ASSERT(boost::filesystem::exists(fileInputPath));
boost::scoped_ptr<boost::filesystem::ifstream> dataContainer(new boost::filesystem::ifstream(fileInputPath));
std::string flist(""), element("");
PTR_CONT<PTR_CONT<T> > dataSet;
PTR_CONT<T> line;
typedef boost::unordered_map<T, T> genericMap;
using boost::assign::operator+=;
while (std::getline(*dataContainer, flist))
{
std::stringstream elements(flist);
while (elements >> element)
{
T elem(boost::lexical_cast<T>(element));
line.push_back(new T(elem));
typename genericMap::const_iterator iter(pMap->find(elem));
if (iter == pMap->end())
pMap->insert(typename genericMap::value_type(elem, 1));
else
(*pMap)[elem] += 1;
}
dataSet.push_back(boost::addressof(line));
line.clear();
}
return dataSet;
}
vecVecInt dataSet = apriori::getDataSet<int, boost::ptr_vector>(fileInput, boost::addressof(pMap)).clone();
// error on the line above.
./cs522/c++/aprioriMain.cpp:62: note: synthesized method 'boost::ptr_vector<boost::ptr_vector<int, boost::heap_clone_allocator, std::allocator<void*> >, boost::heap_clone_allocator, std::allocator<void*> >::ptr_vector(const boost::ptr_vector<boost::ptr_vector<int, boost::heap_clone_allocator, std::allocator<void*> >, boost::heap_clone_allocator, std::allocator<void*> >&)' first required here
./cs522/c++/aprioriMain.cpp:62: error: initializing temporary from result of 'boost::ptr_vector<T, CloneAllocator, Allocator>::ptr_vector(std::auto_ptr<boost::ptr_vector<T, CloneAllocator, Allocator> >) [with T = boost::ptr_vector<int, boost::heap_clone_allocator, std::allocator<void*> >, CloneAllocator = boost::heap_clone_allocator, Allocator = std::allocator<void*>]'
Also off topic how would I do set_intersection and set_union since they are not available in container of pointer class.
On Nov 21, 2007 1:31 PM, Thorsten Ottosen <
thorsten.ottosen@dezide.com> wrote:
> chun ping wang skrev:
> > Hi, since ptr_vector are non copyable,
>
> remark: they will be in 1.35
>
> > how would i got baout making
> > assignment from one ptr_vector to another..
> >
> > i.e. ptr_vector<Foo> t;
> > ptr_vector<Foo> t2;
> > // some coding.
> > t = t2;
>
> t =
t2.clone();
>
> -Thorsten
>
> _______________________________________________
> Boost-users mailing list
> Boost-users@lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>