|
push_back is just a member function of the vector class that adds an element to the end of the list - so it needs an argument of the correct type. What you are supplying as an argument is a pair constructor, which takes one of each type as its arguments (not three arguments, which is what the compiler is complaining about in the second message).
The first message is complaining about an undefined type.
struct vectorstruct{
int x;
string str;
} mystruct;
- this actually declares a structure with a type name of "vectorstruct" and an instance of this type called "mystruct". You should use "vectorstruct" instead of "struct mystruct" in your vector declaration.
Where you have
vector< pair< vector< long double >,struct mystruct >> vic;
- this is actually a vector of pairs, the pair's first member being a vector of long doubles and the second being a "struct mystruct".
Adding a constructor to the struct would make it easier to write the push_back section of code, and getting rid of the pair altogether would probably make things a lot clearer. You could even move the inner vector into the struct if it really is supposed to go inside the pair.
|
|
|
|
|
Hello all members,
I have this problem :
public CSelBCGProp : public CBCGPProp
{
...
public:
virtual BOOL PushChar (UINT nChar);
..
}
I created a class CSelBCGProp that inherits from CBCGPProp I added the event PushChar that lets run a piece of code when the user types a character. (this may be known by all members )
But the problem is that this event does not fire, while the other events that are triggered!!
have you an idea on this case please
|
|
|
|
|
How we can guess the cause with the code you provided?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The class CBCGPProp is a standard class (delivered with BCGTool) and it seems like this:
class BCGCBPRODLLEXPORT CBCGPProp : public CObject
{
DECLARE_DYNAMIC(CBCGPProp)
friend class CBCGPPropList;
// Construction
public:
// Group constructor
CBCGPProp(const CString& strGroupName, DWORD_PTR dwData = 0,
BOOL bIsValueList = FALSE);
// Simple property
CBCGPProp(const CString& strName, const _variant_t& varValue,
LPCTSTR lpszDescr = NULL, DWORD_PTR dwData = 0,
LPCTSTR lpszEditMask = NULL, LPCTSTR lpszEditTemplate = NULL,
LPCTSTR lpszValidChars = NULL);
virtual ~CBCGPProp();
enum ClickArea
{
ClickExpandBox,
ClickName,
ClickValue,
ClickDescription
};
// Operations:
public:
int GetExpandedSubItems (BOOL bIncludeHidden = TRUE) const;
BOOL AddSubItem (CBCGPProp* pProp);
BOOL RemoveSubItem (CBCGPProp*& pProp, BOOL bDelete = TRUE);
.
.
.
public:
virtual BOOL OnEndEdit ();
virtual void OnClickButton (CPoint point);
virtual BOOL OnClickValue (UINT uiMsg, CPoint point);
virtual BOOL OnDblClick (CPoint point);
virtual void OnSelectCombo ();
virtual void OnCloseCombo();
virtual BOOL OnSetCursor () const;
virtual BOOL PushChar (UINT nChar); ...}
in my CSelBCGProp.cpp it seems like this :
BOOL CSelBCGProp::PushChar (UINT nChar)
{
nChar;
return true;
}
What i need is to know the character that the user enter it and make a treatment on it.
|
|
|
|
|
Mr palini your cutout is a fuse it seems. I was just going through the forum and saw that palini doesn ot answer quesitns but rather makes a joke of the people. this is a forum to discuss and not boast around. get out if you do not wish to help people out here.
|
|
|
|
|
tom groezer wrote: Mr palini
is Pallini.
Are you able to guess the error just examining the provided code?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Are you able to guess the error just examining the provided code?
Nah, he's too busy not Googling the answer to his own problem.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
1.) Please post the class definition of CBCGPProp ,
0.) if the event can be catched on its (CBCGPProp ) level
virtual void BeHappy() = 0;
|
|
|
|
|
The class CBCGPProp is a standard class (delivered with BCGTool) and it seems like this:
class BCGCBPRODLLEXPORT CBCGPProp : public CObject
{
DECLARE_DYNAMIC(CBCGPProp)
friend class CBCGPPropList;
// Construction
public:
// Group constructor
CBCGPProp(const CString& strGroupName, DWORD_PTR dwData = 0,
BOOL bIsValueList = FALSE);
// Simple property
CBCGPProp(const CString& strName, const _variant_t& varValue,
LPCTSTR lpszDescr = NULL, DWORD_PTR dwData = 0,
LPCTSTR lpszEditMask = NULL, LPCTSTR lpszEditTemplate = NULL,
LPCTSTR lpszValidChars = NULL);
virtual ~CBCGPProp();
enum ClickArea
{
ClickExpandBox,
ClickName,
ClickValue,
ClickDescription
};
// Operations:
public:
int GetExpandedSubItems (BOOL bIncludeHidden = TRUE) const;
BOOL AddSubItem (CBCGPProp* pProp);
BOOL RemoveSubItem (CBCGPProp*& pProp, BOOL bDelete = TRUE);
.
.
.
public:
virtual BOOL OnEndEdit ();
virtual void OnClickButton (CPoint point);
virtual BOOL OnClickValue (UINT uiMsg, CPoint point);
virtual BOOL OnDblClick (CPoint point);
virtual void OnSelectCombo ();
virtual void OnCloseCombo();
virtual BOOL OnSetCursor () const;
virtual BOOL PushChar (UINT nChar);
...}
in my CSelBCGProp.cpp it seems like this :
BOOL CSelBCGProp::PushChar (UINT nChar)
{
nChar;
return true;
}
What i need is to know the character that the user enter it and make a treatment on it.
|
|
|
|
|
Please set a breakpoint in the body of CBCGPProp::PushChar(..) :
can you get a stop there ?
virtual void BeHappy() = 0;
|
|
|
|
|
Sorry for the delayed response,
I can't access to it in debug mode
But there is something make me confused that when i give properties of allowing edit the value false (not editable) this event (PushChar) is triggered !!!!!!!!
|
|
|
|
|
Hi everyone,
I'm currently using a vector of vectors (which includes a pair of objects), I declare it as:
vector< pair< vector< long double >,string > > vec;
the problem is, I really need a "triple" which I know doesn't exist, so does anyone know how I could add an additional variable such as an additional vector of integers into the mix, and if so, how I'd load and access the data?
I currently use the following to load data:
vec.push_back(pair< vector< long double >,string > (row_temp, header));
where row_temp is a vector of "long doubles" and "header" is a string.
and I use the following to access the data:
newvec[zz].first[yy]
newvec[zz].second.data()
where zz and yy are just integer variables based on the loop that I'm currently in.
The reason that I'm needed to treat so many items as a single object is that I perform some sorting and "unique" routines on the vectors in the end.
Thanks in advance!
|
|
|
|
|
create a 'triple' class to replace the 'pair'... ?
template <class T1, class T2, class T3> triple
{
triple (const & T1 a, const & T2 b, const & T2 c)
{
first = a;
second = b;
third = c;
}
.. etc..
T1 first;
T2 second;
T3 third;
};
?
|
|
|
|
|
Thanks for the quick reply!
Where do I need to put this template class (I'm using visual studio c++)?
Thanks!
|
|
|
|
|
put it in a new .H file and #include it where you need to use it.
if i was going to do this, i'd find the source for std::pair, copy it, then modify it to add the 'third' member . that way, i'd be sure to get all the c-tors and operators that i'd need, without having to add them one-by-one as the compiler complains.
you can probably find some std::pair implementations on-line, otherwise search your Visual Studio include files for "struct pair", to find the one that ships with your version of VC++.
|
|
|
|
|
|
b-rad311 wrote: the problem is, I really need a "triple" which I know doesn't exist
If you have a recent MS compiler, i would suggest using the tuple[^] class. Very easy to use and does exactly what you want.
|
|
|
|
|
Hello
I need the c code to perform the following task "Given an IP address, check for validity of IP address".
Suppose the ip address is 172.16.10.61. So it is a valid address. Here to check it by taking separately each byte and check the range( 0-255) ( for exapmle using strtok(ipaddress, ".") ).I work in a fedora Linux 11. Instead of using the strtok on ip address string any direct library function is there?
Thanking you,
Krishna
modified on Thursday, March 25, 2010 8:51 AM
|
|
|
|
|
Let Me Google That For You.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Google gives the solution in php program, but I want in c-code
|
|
|
|
|
Damn you google! :shakes fist:
|
|
|
|
|
krish_kumar wrote: but I want in c-code...
Which is exactly what was provided to you.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Google's first hit: "How to validate IP address in C"...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I would like to know if there are some good tools available to get the reverse engineered diagrams given
a set of files under a legacy project that needs to be reused and refactored.
It would be great if someone categorizes into Freeware open sources ones and that which comes with a cost.
|
|
|
|
|
Can't beat IDA Pro[^] with the decompiler plugin. screen shot[^]
There's a demo available. The disassembler and the decompiler pair will set you back about $3800 USD.
|
|
|
|