i have some issue, i'm trying to ceate class as template and use iostream operator overloading as well.
for some cause, i got some error ->
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class Interval<int> const &)" (??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABV?$Interval@H@@@Z) referenced in function "void __cdecl testIntervalInt(void)" (?testIntervalInt@@YAXXZ) Project11 C:\Users\eladb\source\repos\Project11\Project11\main.obj 1
my piceses code -
class seclration -
#ifndef INTERVAL_H
#define INTERVAL_H
#include <iostream>
using namespace std;
template <class T1>
class Interval
{
template <class T1> class X
{
// ...
template <class T2> friend YYY ... ;
};
is not a very good idea unless it is a design requirement to make an unbounded set of friend functions/classes. Fatuous friendship is never a good idea.
One last attempt to keep declaration and definition separate, even if for templated functions they are going to end up in the same file anyway.
(And yes, I'm well aware that - for short functions - I could simply define them within the class declaration. This is just an attempt to see how separation could be effected in the case of much longer functions.)
Confused. Other than changing the name of the template parameters (which had been left to compare with the previous "fatuous" version), what was the point of repeating the post?
I'm not 100% sure what borges' meant by 'fatuous friendship' other than if you have too many types gaining access via the friend functionality there is an expanding potential for the principle of data-hiding wrt private members to break down.
I even checked wikipedia an fatuous love which has interesting parallels with the unwanted intrusion, the pitfalls of love at first sight, love triangles and perhaps even std transmission. Whether borges went that far in the metaphor I don't know.
I decided not to comment at the time, because I concluded one T ( ie T or T1 or T2 alone) type was better than multiples, and fuckit, mine was clear of that hence my silence until now.
I then arranged for a green tick, upon which you came back, still showing the variety of T's, a course of action you are fully entitled to.
So I thought I would test my hypothesis that perhaps borges was concerned (infatuated perhaps?) by multiple T's.
I tested my hypothesis and there appears to be no need for extras as the result is the same. I posted accordingly.
I have no reason to believe other than speculation that my hypothesis is in line with borges adverse assessment or that you have some special reason for multiple T's.
Only you two know your motivations, reasons and criteria. Mine worked and that's all that mattered to me at the time.
That was the point of the post. Thank you for asking.