dimanche 8 novembre 2015

tree.hh doesn't compile on Ubuntu 14.04

I am using the latest tree.hh from http://ift.tt/1XY68FU. It produces the errors (please see below). How can I fix it? How can this class produce so many errors? Thanks in advance for your suggesstions?

In file included from item_tree.h:4:0,
                   from Player.h:44,
                   from xinemediaplayer.c:26:
tree.hh:82:36: error: expected ‘,’ or ‘...’ before ‘&&’ token
     tree(tree<T, tree_node_allocator>&&);           // move constructor^M
                                      ^
  tree.hh:82:38: error: invalid constructor; you probably meant ‘tree<T, tree_node_allocator> (const tree<T, tree_node_allocator>&)’
     tree(tree<T, tree_node_allocator>&&);           // move constructor^M
                                        ^
  tree.hh:85:70: error: expected ‘,’ or ‘...’ before ‘&&’ token
     tree<T,tree_node_allocator>& operator=(tree<T, tree_node_allocator>&&);        // move assignment^M
                                                                        ^
  tree.hh:503:64: error: expected ‘,’ or ‘...’ before ‘&&’ token
   tree<T, tree_node_allocator>::tree(tree<T, tree_node_allocator>&& x) ^M
                                                                  ^
  tree.hh:503:1: error: prototype for ‘tree<T, tree_node_allocator>::tree(tree<T, tree_node_allocator>)’ does not match any in class ‘tree<T, tree_node_allocator>’
   tree<T, tree_node_allocator>::tree(tree<T, tree_node_allocator>&& x) ^M
   ^
  tree.hh:81:3: error: candidates are: tree<T, tree_node_allocator>::tree(const tree<T, tree_node_allocator>&)
     tree(const tree<T, tree_node_allocator>&);      // copy constructor^M
     ^
  tree.hh:80:3: error:                 tree<T, tree_node_allocator>::tree(const tree<T, tree_node_allocator>::iterator_base&)
     tree(const iterator_base&);^M
     ^
  tree.hh:496:1: error:                 tree<T, tree_node_allocator>::tree(const T&)
   tree<T, tree_node_allocator>::tree(const T& x) ^M
   ^
  tree.hh:490:1: error:                 tree<T, tree_node_allocator>::tree()
   tree<T, tree_node_allocator>::tree() ^M
   ^
  tree.hh:562:98: error: expected ‘,’ or ‘...’ before ‘&&’ token
   tree<T,tree_node_allocator>& tree<T, tree_node_allocator>::operator=(tree<T, tree_node_allocator>&& x)^M
                                                                                                    ^
  tree.hh: In member function ‘tree<T, tree_node_allocator>& tree<T, tree_node_allocator>::operator=(tree<T, tree_node_allocator>)’:...

an example of tree.hh:

64 template <class T, class tree_node_allocator = std::allocator<tree_node_<T> > >
65 class tree {
66         protected:
67                 typedef tree_node_<T> tree_node;
68         public:
69                 /// Value of the data stored at a node.
70                 typedef T value_type;
71
72                 class iterator_base;
73                 class pre_order_iterator;
74                 class post_order_iterator;
75                 class sibling_iterator;
76       class leaf_iterator;
77
78                 tree();                                         // empty constructor
79                 tree(const T&);                                 // constructor setting given element as head
80                 tree(const iterator_base&);
81                 tree(const tree<T, tree_node_allocator>&);      // copy constructor
82                 tree(tree<T, tree_node_allocator>&&);           // move constructor
83                 ~tree();
84                 tree<T,tree_node_allocator>& operator=(const tree<T, tree_node_allocator>&);   // copy assignment
85                 tree<T,tree_node_allocator>& operator=(tree<T, tree_node_allocator>&&);        // move assignment
86
87       /// Base class for iterators, only pointers stored, no traversal logic.
88 #ifdef __SGI_STL_PORT
89                 class iterator_base : public stlport::bidirectional_iterator<T, ptrdiff_t> {
90 #else

Aucun commentaire:

Enregistrer un commentaire