Cicularbuffer in function #42
-
Hi i can use the name buffer in fonction parameter like. Int MyFonction (???? Buffer){ For(i=0,i<buffer.size(),i++){ Int avt +=Buffer[i] } |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
First of all, your question is not clear at all, so my answer is my best guess of what you might have been asking. My guess then is you want to pass an instance of CircularBuffer to a function, which you can obviously do:
You can call such function as You can define a templated function if you put the following in a header file though:
As you can see the size is now variable, so the Anyways, this is plain C++ programming, so please refer to a good C++ manual or tutorial covering templates. |
Beta Was this translation helpful? Give feedback.
First of all, your question is not clear at all, so my answer is my best guess of what you might have been asking.
My guess then is you want to pass an instance of CircularBuffer to a function, which you can obviously do:
You can call such function as
sum(buffer)
wherebuffer
must be an instance ofCircularBuffer<int, 100>
.You can define a templated function if you put the following in a header file though: