Singly Linked List Implementation (With Nodes) This code was recommended to me by my dear friend Jon after I wrote an implementation using arrays. With his help, I managed to create a Singly linked List similar to std::vector using Nodes. 

#include &lt;iostream&gt;

template &lt;class T&gt;
class LinkedList
{
private:
    size_t _size;
public:

    class Node
    {
    public:
        Node* next;
        T value;
        Node(T val) : value(val), next(NULL) {}
    };

    Node* head;

    LinkedList() : _size(0), head(NULL) {}

    ~LinkedList() {
        std::cout &lt;&lt; "Linked List Deleted!" &lt;&lt; std::endl;
    }

    void push(T val) {
        Node* node = new Node(val);
        node-&gt;next = head;
        head = node;
        ++_size;
    }
    size_t size() {
        return _size;
    }
    bool empty() const {
        return head == NULL;
    }
    T pop() {
        Node* n = head;
        if (n == NULL) return NULL;
        head = n-&gt;next;
        _size--;
        return n-&gt;value;


    }
};

int main() {
    LinkedList&lt;int&gt; list;
    std::cout &lt;&lt; "Empty: " &lt;&lt; list.empty() &lt;&lt; std::endl;
    list.push(5);
    list.push(6);
    list.push(7);
    list.push(8);
    list.push(9);
    list.push(10);
    std::cout &lt;&lt; "Empty: " &lt;&lt; list.empty() &lt;&lt; std::endl;

    std::cout &lt;&lt; "Size: " &lt;&lt; list.size() &lt;&lt; std::endl;
    list.pop();

    std::cout &lt;&lt; "Size: " &lt;&lt; list.size() &lt;&lt; std::endl;
    LinkedList&lt;int&gt;::Node* n = list.head;
    while (n != NULL) {
        std::cout &lt;&lt; n-&gt;value &lt;&lt; std::endl;
        n = n-&gt;next;
    }
}
I recommend you compile with more warnings enabled.  That would alert you to these problems:

g++ -std=c++11 -fPIC -g -Wall -Wextra -Wwrite-strings -Wno-parentheses -Wpedantic -Warray-bounds  -Weffc++       208038.cpp    -o 208038
208038.cpp: In instantiation of ‘class LinkedList&lt;int&gt;’:
208038.cpp:50:21:   required from here
208038.cpp:4:7: warning: ‘class LinkedList&lt;int&gt;’ has pointer data members [-Weffc++]
 class LinkedList
       ^~~~~~~~~~
208038.cpp:4:7: warning:   but does not override ‘LinkedList&lt;int&gt;(const LinkedList&lt;int&gt;&amp;)’ [-Weffc++]
208038.cpp:4:7: warning:   or ‘operator=(const LinkedList&lt;int&gt;&amp;)’ [-Weffc++]
208038.cpp: In instantiation of ‘T LinkedList&lt;T&gt;::pop() [with T = int]’:
208038.cpp:61:14:   required from here
208038.cpp:40:31: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
         if (n == NULL) return NULL;
                               ^~~~
208038.cpp: In instantiation of ‘LinkedList&lt;T&gt;::Node::Node(T) [with T = int]’:
208038.cpp:27:22:   required from ‘void LinkedList&lt;T&gt;::push(T) [with T = int]’
208038.cpp:52:16:   required from here
208038.cpp:14:11: warning: ‘LinkedList&lt;int&gt;::Node::value’ will be initialized after [-Wreorder]
         T value;
           ^~~~~
208038.cpp:13:15: warning:   ‘LinkedList&lt;int&gt;::Node* LinkedList&lt;int&gt;::Node::next’ [-Wreorder]
         Node* next;
               ^~~~
208038.cpp:15:9: warning:   when initialized here [-Wreorder]
         Node(T val) : value(val), next(NULL) {}
         ^~~~


The lack of consideration of copy/move behaviour is particularly concerning, given that we have a pointer which we own.  The destructor is also faulty, failing to release the allocated resource:

valgrind -q --leak-check=full ./208038   
Empty: 1
Empty: 0
Size: 6
Size: 5
9
8
7
6
5
Linked List Deleted!
==18193== 96 (16 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record 6 of 6
==18193==    at 0x4835E2F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18193==    by 0x1094BD: LinkedList&lt;int&gt;::push(int) (208038.cpp:27)
==18193==    by 0x109276: main (208038.cpp:57)
==18193== 


Remember the guideline - whenever you write new or new[], make sure you know where the corresponding delete or delete[] is!  (Don't forget that you need a delete in the pop() method, too).

There's no need for Node to be a class:

struct Node
{
    T value;
    Node* next;
};




void push(T val) {
    head = new Node{std::move(val), head};
    ++_size;
}


I think it would be better if it didn't need to be public, either - there's nothing to stop broken code messing up the guts of the list.  We'd like a way to iterate through the values of the list without having to understand its innards, and without being able to accidentally change it (potentially breaking the size invariant).

Finally, std::size_t is written incorrectly throughout, and is missing its header (&lt;iostream&gt; is not one of the headers specified to define this type).