|
The ctltype will help yo distinguish thanks
|
|
|
|
|
I have a Clist however the type is defined as a structure
My question is I would like to match up against a member in the structure is this possible ? there maybe more that one occurence
Thanks
|
|
|
|
|
It's not clear what you're trying to do.
Define "match up against a member in the structure".
Maybe share a code sample.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Consider the following structure
struct stdecs
{
struct vsmdesc stordesc;
char *tcb = " ";
struct blkdesc blkdescx;
CList<blkdesc, blkdesc> freeblock;
CList<blkdesc, blkdesc> allocblock;
};
with the following Clist definition
CList<stdecs, stdecs> storagediscriptor;
Could I match for an equal against member tcb ? or any other member of the type stdesc
thanks
|
|
|
|
|
Sure, how about:
stdecs anotherinstance;
if (storagediscriptor[4].tcb == anotherinstance.tcb)...
if (storagediscriptor[5].stordesc == anotherinstance.stordesc)...
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I would have to loop
unitl storagediscriptor.GetNext == NULL
inspecting the member which is not too bad
thanks
|
|
|
|
|
You're welcome!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I figured push_back is for adding things at the front but if you want things added at the tail you should probably use insert. I`m having trouble calling insert, I don`t know how to fill in the parameters. Could someone lend a helping hand?
Quote: void AddTask(vector<task *=""> * UnitTasks, int type )
{
Task * T = new Task();
T->Type = type;
int nSize = UnitTasks->empty() ? -1 : static_cast<int>(UnitTasks->size());
UnitTasks->insert(T,nSize);//?
}
modified 26-Apr-22 1:54am.
|
|
|
|
|
Actually, as its name suggestes, push_back adds an item at the back of the vector.
Try the following sample code in order to see insert in action:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector <int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
cout << "v-front " << v.front() << "\n";
cout << "v-back " << v.back() << "\n";
v.insert(v.begin(), 4);
cout << "v-front " << v.front() << "\n";
v.insert(v.end() - 1, 5);
v.insert(v.end(), 6);
for (auto x : v) cout << x << " ";
cout << "\n";
}
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
Thanks CPallini
the reason for which the ide wouldn`t accept my insert function was because I switched the order of parameters in the function, the intellisense function helper description is impossible to understand.
modified 26-Apr-22 9:09am.
|
|
|
|
|
You are welcome.
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
Hi,
Just wanted to point out that you should choose the right STL container. The vector is designed for sequential insertion/access. If you want to frequently insert at both ends then you should consider using a std::deque
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks for your tip, at this point I`m still not sure what I want to use.
|
|
|
|
|
This should likely be in a lounge rant, but it is technical.
I have a project on a system that I need to compile to fix an issue. The issue is trivial. But when I go to Build...all it gives me is "Run Code Analysis on Solution".
I've reset permissions on the folder, I have made sure 2015 is up to date, but 2015 won't give me the prompts.
What am I missing?
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
Did you try to Rebuild All (or how is it exactly called in VS2015? - I cannot recall ...)?
|
|
|
|
|
It's not in the menu. This is maddening
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
How about:
Rebuild <project>
Rebuild solution
in the menu "Build"?
Or just "Clear solution"?
|
|
|
|
|
|
|
Rep-point fluffing to get his spam link shown in his profile.
Message and user reported.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Victor Nijegorodov wrote: What is it?
Spam.
|
|
|
|
|
Check that your .vcxproj files are there. If they are, check the Properties of your project(s) to see if their dependencies are correct and if they generally make sense.
|
|
|
|
|
Weird, never figured it out. Pulled the project from a zip file, and it built.
Appreciate all the suggestions.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
charlieg wrote: What am I missing? Presidents shouldn't be compiling software. You need a software developer.
|
|
|
|
|
lol, true. I'm also the treasurer. It's oh dark thirty here and thanks for the laugh.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|