About Standard Template Library

R

r3694117

i am a kookie in C++ ,and don't understand many things like following
example.

Write a function template palindrome that takes a vector parameter and
returns TRue or false according to whether the vector does or does not
read the same forward as backward .

can someone help me?thx!!
 
L

loufoque

Write a function template palindrome that takes a vector parameter and
returns TRue or false according to whether the vector does or does not
read the same forward as backward .

We don't do homework.
As this is trivial, the answer is probably in your book or lessons.
 
D

Daniel T.

i am a kookie in C++ ,and don't understand many things like following
example.

Write a function template palindrome that takes a vector parameter and
returns TRue or false according to whether the vector does or does not
read the same forward as backward .

Kind of an odd request. I would expect such a function to take a
basic_string, not a vector.
 
V

Victor Bazarov

Daniel said:
Kind of an odd request. I would expect such a function to take a
basic_string, not a vector.

I would probably expect it to take two iterators, which would make it
possible to be used with any standard containers, basic_string included.

V
 
D

Daniel T.

Victor Bazarov said:
I would probably expect it to take two iterators, which would make it
possible to be used with any standard containers, basic_string included.

Noah said the same thing. Two bi-directional iterators? That makes
sense; the string might contain more than one word and using iterators
would allow one to isolate each word.
 
O

osmium

Daniel T. said:
Kind of an odd request. I would expect such a function to take a
basic_string, not a vector.

The first thing to do when confronted with some odd sounding request such as
this is to belabor the word defintions. From the first hit on <define:
palindrome> on google:

"A sequence that reads the same in either direction;
in genetics, refers to an enzyme recognition sequence
that reads the same on both strands of DNA."
 
Z

Zara

The first thing to do when confronted with some odd sounding request such as
this is to belabor the word defintions. From the first hit on <define:
palindrome> on google:

"A sequence that reads the same in either direction;
in genetics, refers to an enzyme recognition sequence
that reads the same on both strands of DNA."

Hey, what about "being a kookie"? Does it mean OP is sweet and edible?

Zara
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top