arguments

Started by
17 comments, last by FGFS 10 years, 8 months ago

Hi

what arguments does it want?

- invalid use of ‘std::vector<Procedure*>::value_type’
- Invalid arguments ' Candidates are: unsigned long int count(const std::basic_string<char,std::char_traits<char>,std::allocator<char>>

What are char_traits, allocator etc.

Thanks

Advertisement
Can you please show the code that you get the error from.

it's huge...

and what is the "?"

IFSDatabase::getAppr(&it);

nvalid arguments ' Candidates are: std::vector<Procedure *,std::allocator<Procedure *>> getAppr(const ? &) '

the declaration is:

virtual ProcedureList getAppr(const QString &id);

and the class:

class Procedure : public Route
{
public:

Procedure();

Procedure(const QString& id,
const QStringList& runway_list);

virtual ~Procedure() {};

virtual const Procedure* asProcedure() const { return this; }
virtual Procedure* asProcedure() { return this; }

virtual QString toString() const;

/////////////////////////////////////////////////////////////////////////////

const QStringList& runwayList() const { return m_runway_list; }
void setRunwayList(const QStringList& runway_list) { m_runway_list = runway_list; }

protected:

QStringList m_runway_list;
};

/////////////////////////////////////////////////////////////////////////////

typedef vector<Procedure*> ProcedureList;
typedef PtrList<Procedure> ProcedurePtrList;
typedef QListIterator<Procedure*> ProcedurePtrListIterator;

and

class IFSDatabase
{
public:

IFSDatabase();
virtual ~IFSDatabase() {};
virtual void load();
...
virtual ProcedureList getAppr(const QString &id);

...

Are you passing a std::string to getAppr or something?

for (std::multimap<string, ProcedureList>::iterator it=m_procedure_map.begin(); it!=m_procedure_map.end(); ++it)
{
const char* msga = IFSDatabase::getAppr(&it);

You have got all the types wrong. You have declared getAppr to take a QString as argument but you try to pass it a pointer to an iterator, and then you try to store the return value as a char pointer when the function actually returns a vector.

I don't see how you expected this to work. Did you maybe call the wrong function?

Yes, so how to pass a QString and store the return value? Basically I want first to see the value, hence I tried char*.

Thanks

So I guess you want to pass the map key to the function. I have never used Qt but from the documentation it seems that std::string will not be converted to a QString implicitly so you probably have to use the fromStdString function.

The value type of the map is the same as the return type of the function so I guess you want to assign the returned value to that vector in the map.

.. so I guess it would look something like this:
it->second = IFSDatabase::getAppr(QString::fromStdString(it->first));

Thanks

with:

const char* msga = IFSDatabase::getAppr(QString::fromStdString(it->first));

I get:

- cannot convert ‘ProcedureList {aka std::vector<Procedure*>}’ to ‘const char*’ in initialization

sure but how to view the values. Also with std::cout << I get errors.

but with second:

IFSDatabase::getAppr(QString::fromStdString(it->second));

i get:

Multiple markers at this line
- Function 'fromStdString' could not be resolved
- Invalid arguments ' Candidates are: std::vector<Procedure *,std::allocator<Procedure *>> getAppr(const ?
&) '
- no matching function for call to ‘QString::fromStdString(std::vector<Procedure*>&)’
- candidate is:

Have you included <QString>?

This topic is closed to new replies.

Advertisement