I cant understand this line of code from source code at github :
using NodePtr = std::shared_ptr<Node>;
I read the cppreference page here, but it didn't have any information regarding similar syntax. As much as I can guess, it is somewhat like #define
in that when I use NodePtr
from now on, it will replace it internally with std::shared_ptr<Node>
. With that, I tried to test code but it didn't work.
Code :
test.h
:
#ifndef TEST_H_
#define TEST_H_
#include <memory>
#include <string>
#include <vector>
#include <unordered_map>
#include <utility>
#include <typeinfo>
#include <limits>
#include <functional>
namespace nnvm {
class Node;
using NodePtr = std::shared_ptr<Node>;
class Node {
public:
~Node();
inline bool is_variable() const;
inline int num_outputs() const;
inline int num_inputs() const;
};
}
#endif // TEST_H_
test.cpp
:
#include "test.h"
#include <iostream>
static graphy::NodePtr Create();
int main(int argc, char const *argv[])
{
/* code */
graphy::Node *node = new graphy::Node();
std::cout << "Hello Graphy!!" << std::endl;
return 0;
}
Here is the error I get :
In file included from /usr/include/c++/5/unordered_map:35:0,
from test.h:7,
from test.cpp:1:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
In file included from test.cpp:1:0:
test.h:18:7: error: expected nested-name-specifier before ‘NodePtr’
using NodePtr = std::shared_ptr<Node>;
^
test.cpp:5:14: error: ‘NodePtr’ in namespace ‘graphy’ does not name a type
static graphy::NodePtr Create();
^