Is it possible using Boost mpl library:-
Assume any class implementing a function "connect" with two arugments of
fixed types
class protocol1
{
connect(T0 & t0, T1 &t1 ){..} //fixed types T0 and T1
};
class protocol2
{
connect(T2 & t0, T3 &t1 ){..} // Fixed types T2 and T3
};
Now a function say "connect_protocols" which take two protocols of above
mentioned protocol types
template<typename P0, typename P1>
connect_protocols(P0& p0, P1 & p1)
{..}
What is requires in the body of "connect_protocols" function is a checking
meachimism to use correct connect function avilable from one of the class
(protocol1 or protocol2) without genrating the compile time error.
However if no appropriate connect function is avilable (after checking both
the protocol classes) then genrate compile time error.
Is it possible?
Abhsishek