Access declarations become obsolete in favor of the use of declarations; suggestion: add the keyword 'using

I returned to one of my old C ++ schoolwork that implemented a binary tree. I have a file (Tree.cpp) that contains functions for inserting, searching, deleting, etc. Knots. Upstairs with me "using namespace std;". The warnings that I get are caused by another SymTab.hpp file, which looks like this:

#ifndef SYMTAB_H
#define SYMTAB_H

#include <iostream>
#include "Tree.hpp"
using namespace std;

template <class Whatever>
class SymTab : private Tree<Whatever> {
public:
        Tree<Whatever> :: Insert;
        Tree<Whatever> :: Lookup;
        Tree<Whatever> :: Remove;
        Tree<Whatever> :: Write;
        Tree<Whatever> :: Set_Debug_On;
        Tree<Whatever> :: Set_Debug_Off;
};

#endif

Each line after public:gives a warning:

"SymTab.hpp: 11: 9: warning: access declarations are deprecated in favor of using declarations; suggestion: add the keyword 'using [-Wdeprecated] Tree :: Insert;" where "Insert is replaced" with each corresponding function name.

?

+4
1

. , , - " " SymTab. :

template <class Whatever>
class SymTab : private Tree<Whatever> {
public:
        using Tree<Whatever> :: Insert;
        using Tree<Whatever> :: Lookup;
        using Tree<Whatever> :: Remove;
        using Tree<Whatever> :: Write;
        using Tree<Whatever> :: Set_Debug_On;
        using Tree<Whatever> :: Set_Debug_Off;
};

, - using namespace std; . , TM. , std , , . , transform, list sort, std. using.

+6

Source: https://habr.com/ru/post/1545102/


All Articles