Syntax Error with c++ & Arduino IDE

I want to port this c++ code in Arduino.

I have problem in

                   // empty the larger size pq to the smaller one
                   
                   if((pq[pqi].size())>(pq[1-pqi].size())) pqi=1-pqi;

Where pq is my queuearray.

Error:

error: expression cannot be used as a function

                    if((pq[pqi].size())>(pq[1-pqi].size())) pqi=1-pqi;

i have tried alot but couldn't resolve it.

my c++ code & arduino code is attached.

Instead of chopping up your code like a chicken to fit it into a post, attach it.

Please read How to use this forum

I don't think the priority queue data structure is available for arduino as it has not been coded with super low memory availability constraints

check the comments in

http://playground.arduino.cc/Main/LibraryList and explore the 2 links

Library implementing a generic, dynamic queue (array version)
Library implementing a generic, dynamic queue (linked list version)

okhy now its good.

J-M-L:
I don't think the priority queue data structure is available for arduino as it has not been coded with super low memory availability constraints

check the comments in

http://playground.arduino.cc/Main/LibraryList and explore the 2 links

Library implementing a generic, dynamic queue (array version)
Library implementing a generic, dynamic queue (linked list version)

I understand it, but please help me out in anyother way. I have to do it. what changes can bypass these constraints. thanku

well move to a QueueArray for example.

for that look in your code and change all the creation of variables of your old queues types into

QueueArray <T> queue;

to create an instance (object) of a QueueArray class (Replace “T” with the data type you want to use)

then the methods push, pop, peep etc are implemented but not the size one where your code is currently chocking. so you need to implement what you expect from size yourself. either add to the library or handle differently in your code.

J-M-L:
then the methods push, pop, peep etc are implemented but not the size one where your code is currently chocking. so you need to implement what you expect from size yourself. either add to the library or handle differently in your code.

what if i change the private size() to public in library?
please give a hint

someone please help me out

have you tried? what did you see?

J-M-L:
have you tried? what did you see?

i have tried editing library of queuearray. but still cant resolve my issue.

i changed the resize() to public but still no progress.. please help help

My recommendation is that you move to using standard libraries dealing with queues that have been developed and meant for an arduino, not a computer with GB of RAM.

I pointed to libraries you can use, you need to invest a bit of time to understand what the code currently have does and how to transform it. if you don't then you'll never be on top of your program and will not be able to debug anything. memory overflows errors are part of the toughest ones to deal with.

i have tried editing library of queuearray.

The code you posted does not include a library named anything like that. So, we have no clue what you are doing.

J-M-L:
My recommendation is that you move to using standard libraries dealing with queues that have been developed and meant for an arduino, not a computer with GB of RAM.

I pointed to libraries you can use, you need to invest a bit of time to understand what the code currently have does and how to transform it. if you don't then you'll never be on top of your program and will not be able to debug anything. memory overflows errors are part of the toughest ones to deal with.

hmmm, btw what if i try eclipse arduino, will that work for me? lol am trying it too.
am just exhausted with arduino IDE. atleast someone should be paid to construct these libraries ASAP

atleast someone should be paid to construct these libraries ASAP

Which libraries? How much are YOU offering to pay?

PaulS:
The code you posted does not include a library named anything like that. So, we have no clue what you are doing.

PaulS:
Which libraries? How much are YOU offering to pay?

the rest of c++ libraries are not available on arduino, for that arduino company should pay someone who will work on it & then make it opensource for their users.

the rest of c++ libraries are not available on arduino

So, port the ones YOU need, where it makes sense. The Arduino does NOT have terabytes of memory, which is something you do NOT seem to understand.

for that arduino company should pay someone who will work on it & then make it opensource for their users.

Complete and utter nonsense. If YOU need something ported, and it makes sense, YOU should pay for it. The world does NOT owe you anything.

PaulS:
So, port the ones YOU need, where it makes sense. The Arduino does NOT have terabytes of memory, which is something you do NOT seem to understand.
Complete and utter nonsense. If YOU need something ported, and it makes sense, YOU should pay for it. The world does NOT owe you anything.

I dont owe arduino company.

As I wrote

check the comments here as I said for “Data Structures and Algorithms”

The Embedded Template Library has been designed for lower resource embedded applications. It implements a set of containers, algorithms and utilities. There is no dynamic memory allocation. The library makes no use of the heap. All of the containers have a fixed capacity allowing all memory allocation to be determined at compile time.

TheEvilGenius427:
OHV1kU - Online IDE & Debugging Tool - Ideone.com
the rest of c++ libraries are not available on arduino, for that arduino company should pay someone who will work on it & then make it opensource for their users.

The STL has already been ported to the Arduino by a number of people. I think the easiest one to use right now is here.