Passing in a Type to a Library

I am an Ex Java programmer so I am very comfortable with the way Lists work in Java. In an attempt to use a Lists in this way I made a list to keep track of points but now I want to expand the utility of the library and make it multi-type compatible.

I know it would be something like List::List(){} but what is the exact syntax for implementing it into a c++ library?

Let me know if any additional information is needed about my use case or the project itself.


#ifndef List_h
#define List_h

#include "Arduino.h"
#include "Point.h"

class List {
    int length;
	Point values[512];

    void add(Point led);   
    Point get(int index);
    void remove(int index);




#include "Point.h"
#include "List.h"
#include "Arduino.h"

List::List() {
	length = 0;
  for(int i = 0; i < 512; i++) {
      values[i] = Point(0,0,0);

void List::add(Point point) {
    values[length - 1] = point;

Point List::get(int index) {
    if(index > length) {
      Serial.println("Error: Index exceeds bounds of list");
      return Point(6,6,6);
    return values[index];  

void List::remove(int index) {
  for(int i = index; i < length; i++) {
      values[i] = values [i +1];

There is no syntax for a C/C++ lib a lib can hold just about anything (and it need not be a class)


Would I need to #include every potential type that I might pass in?

Look up templates. They will let you write code that can handle any type in a list.

I understand I would need to use a template, what confuses me is how to implement it into the header file.

What is the syntax for implementing a template into the header file?