Search code examples
c++b-tree

Error Message C++


I got this error message when trying to compile my code:

btree.h:23: error: expected unqualified-id before 'template'

it comes from this line:

template <typename T> std::ostream& operator<<(std::ostream& os, const btree<T>& tree);

there is absolutely nothing above this line except a bunch of comments and a couple of #include library files, which are:

#include <iostream>
#include <cstddef>
#include <utility>

#include "btree_iterator.h"

my btree_iterator.h holds:

template <typename T>
class btree_iterator  {


}

if someone could tell me whats wrong it'd be much appreciated!


Solution

  • You forgot a semicolon:

    template <typename T>
    class btree_iterator  {
    
    
    };
     ^