Write a template for a function that has parameters for a list of items and for a possible item on the list. If the item is on the list, then the function returns the position of the first occurrence of that item. If the item is not on the list, the function returns −1. The first position on the list is position 0, the next is position 1, and so forth. The type of the items on the list is a type parameter. Use the class template GenericList that you defined in Project 1. Write a suitable program(main function) to test this function template.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 5PE
icon
Related questions
Question

Write a template for a function that has parameters for a list of items and for a possible item on the list. If the item is on the list, then the function returns the position of the first occurrence of that item. If the item is not on the list, the function returns −1. The first position on the list is position 0, the next is position 1, and so forth. The type of the items on the list is a type parameter. Use the class template GenericList that you defined in Project 1. Write a suitable program(main function) to test this function template.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 9 images

Blurred answer
Knowledge Booster
Generic Type
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning