True ... I should have said that is not easy to get it to work in the context of this particular implementation!
to test my multiMap, I have been iterating through a directory tree and using unique directory paths as the key, I store the directories files names within the value... multimap basically does it for me!
I am trying to do the same thing here with the bst/vector combination. I just cannot get anything to work as it (simply) should.
I tried
1 2
|
node(const K& key = K(), const V& value = V()) : key(key), left(0), right(0) {
this->items.push_back(value);
|
but I got an "unhandled exception in my.cpp: access violation reading location 0x00000014" error as soon as the first node is attempted to be inserted.
the error window opens up the xstring library (std::basic_string<_Elem,_traits,_Ax>)
and points to line 1512:
size_type size() const{
return this->_Mysize; } <-- error window points to the return statement.
I click on "break", and there are no errors in the error list.
If I change the your code to an insert:
this->values.insert(this->values.end() , value);
I get the error
error c2664:'std::_Vector_iterator<_Myvec>std::vector<_Ty>::insert<const V&>
(std::_Vector_const_iterator<_Myvec>,_Valty)':cannot convert parameter 1 from 'unsigned int' to 'std::_Vector_const_iterator<_Myvec>'
Is this saying that I am sending it an int, but it wants an iterator? I would swear that an insert is supposed to take an int.
Oy Vey!
And this was supposed to be the "easier" portion of my code... in contrast to the insert() method which I originally posted the question about!!! Although I can see that they are the same problem: I am still having trouble inserting any strings into my vector container?
Thank you so much for your time, as I find this task to be extremely frustrating. I have coded for years and I have never been defeated by two lines of code before.
Obsessed, all I can do is keep hacking away at it.
Last