I have a class that has a std::vetcor of a type of a templated class that
looks like this
template<class cost>
class Pstates
{
public:
Pstates (std::vector< state<cost> > x)
: _vstate{x}
{
for( const auto& y : _vstate)
std::cout << y << std::endl;
};
etc
I can get this to print.
the overload looks like this
friend std::ostream &std::operator<<( std::ostream &output, const
tree::state<cost> &p )
{
output << "nam => " << p.nam() << "\tcost=> " << p.r() << std::endl;
return output;
}
The error that I'm getting is:
|| g++ -Wall -ggdb -c nodes.cpp
|| g++ -Wall -ggdb -o fitch.o -c fitch.cpp
|| nodes.h: In instantiation of ‘tree::Pstates<cost>::Pstates
(std::vector<tree::state<cost> >) [with cost = int]’:
fitch.cpp|15 col 47| required from here
nodes.h|158 col 16| error: no match for ‘operator<<’ (operand types are
‘std::ostream {aka std::basic_ostream<char>}’ and ‘const
tree::state<int>’)
|| std::cout << y << std::endl;
|| ~~~~~~~~~~^~~~
/usr/include/c++/6.2.1/ostream|628 col 5| note: candidate:
std::basic_ostream<_CharT, _Traits>& std::operator<<
(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char;
_Traits = std::char_traits<char>; _Tp = tree::state<int>] <near match>
|| operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
I thought that const tree::state<int> was a match
http://www.nylxs.com/docs/thesis/src/fitch/
and
http://www.nylxs.com/docs/thesis/src/fitch/nodes.h
are the full source. It is small yet.