473,404 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Problem with push_back.


Hi

I am getting error with push_back, some one please help me ASAP in this
aspect here am sending the needful info.

_______________

Class VarbindList:

_______________

#ifndef VARBINDLIST_H

#define VARBINDLIST_H

#include "Varbind.h"

#include "Vector.h"

#include <vector.h>

#include "Snmp.h"

#include "Object.h"

class VarbindList : public Vector {

public:

VarbindList() {

static const string INVALID_OBJ = "Invalid instance";

static const string INVALID_OBJ_VEC = "Not an instance of vector";

}

VarbindList(int initialCapacity);

static VarbindList decodeSequence(Asn1Value aVarbinds);// throws

void addVarbind(Object aVarbind);// throw Exception;

void addVarbinds(vector <Object> aVarbindArray);// throw Exception;

void addVarbinds(Vector aVectorOfVarbinds);// throw Exception;

void addVarbinds(Object aVarbind);// throw Exception;

vector <Varbind> getVarbindArray();

vector <Object> encode();

char * toString();

// Constants

private:

static const string INVALID_OBJ;// = "Invalid instance";

static const string INVALID_OBJ_VEC;// = "Not an instance of vector";

};

#endif // VARBINDLIST_H

___________________

Class NameValuePair:

___________________

# ifndef NAMEVALUEPAIR_H

# define NAMEVALUEPAIR_H

#include "Snmp.h"

# include "AllIncludes.h"

class NameValuePair {

private:

string Name;

string Value;

public:

NameValuePair() { }

NameValuePair(string mName, string mValue) {

Name = mName;

Value = mValue;

}

//Get methods..

string name() { return Name; }

string value() { return Value; }

//Set Methods

void name(string mName) { Name = mName; }

void value(string mValue) { Value = mValue; }

};

# endif

And this is the peice of code of a method in which i am getting error
when am using push_back.

Message SnmpSouthAdaptor :: encode(Request req) {

vector<NameValuePair> ar = req.arr();

VarbindList varbinds;// = VarbindList();

for ( int i = 0; i < ar.size(); ++i ) {

varbinds.push_back(ar); //Error Here

}

}

Here in varbinds.push_back(ar), i have to type cast the type of ar
from vector<NameValuePair> to the type VarbindList but am not getting
how to do this,since the type of the ar is not the same as the type
of varbind am getting error :

no matching function for call to `VarbindList::push_back
(NameValuePair &)'

Here VarbindList is a class and varbinds is the object of the class
VarbindList and ar is of type vector<NameValuePair>.

I wrote the class declarations of both VarbindList and NameValuePair on
the top.Please help me ASAP
--
Posted via http://dbforums.com
Jul 19 '05 #1
0 1600

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Christian Stigen Larsen | last post by:
Consider the following: class parent { public: virtual void print() { printf("Parent\n"); } }; class child : public parent {
2
by: Dave | last post by:
I'm crossposting this to both comp.lang.c++ and gnu.gcc because I'm not sure if this is correct behavior or not, and I'm using the gcc STL and compiler. When calling vector<int>::push_back(0),...
5
by: Billy Patton | last post by:
I have a polygon loaded into a vector. I need to remove redundant points. Here is an example line segment that shows redundant points a---------b--------c--------d Both b and c are not...
3
by: nan.li.g | last post by:
Hello, all, This is probably not so much related to C++ (Sorry in advance). But I did get this question during a C++ job interview. You are asked to design some data structure and algorith for the...
2
by: toton | last post by:
Hi, I am trying to use boost::range with one of my own container class, and having some problem. I am missing some usage of range. Can anyone suggest a proper way for it ? To show the problem...
3
by: mast2as | last post by:
sorry i am too sure how to write a more explicit subject but this code doesn't compile for the type string and I am not sure why (and I am not sure either how to describe the problem but by looking...
1
by: shark | last post by:
Hi, all. This time I met a problem in "inserter" functional. My program is like the following: /////////////////////////////////////////////////////////////////////////// #include <iostream>...
2
by: mkvenkit.vc | last post by:
Hello, I hope this is the right place to post a question on Boost. If not, please let me know where I can post this message and I will do so. I am having a strange problem with std::string as...
2
by: Man4ish | last post by:
I have created Graph object without vertex and edge property.It is working fine. #include <boost/config.hpp> #include <iostream> #include <vector> #include <string> #include...
5
by: saneman | last post by:
I have made the following code: std::vector<intv; std::vector<int>::iterator it; v.push_back(0); v.push_back(0); v.push_back(0); v.push_back(1); v.push_back(1); v.push_back(1);
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.