Boost logo

Boost Users :

From: Hicham Mouline (hicham_at_[hidden])
Date: 2008-03-15 08:22:59


Hello
As functions templates cannot be partially specialized, Sutter(05) advices that one can use overload resolution instead:
I have

// header N.h
namespace A
{
namespace B
{
namespace C
{
template<typename cT, typename tT, int n>
void make(const cT&, const tT&, const Head<n>& h) {...}
}
}
}

// header 3.h
namespace A
{
namespace B
{
namespace C
{
template<typename cT, typename tT>
void make(const cT&, const tT&, const Head<3>& h) {...}
}
}
}

// header 2.h
namespace A
{
namespace B
{
namespace C
{
template<typename cT, typename tT>
void make(const cT&, const tT&, const Head<2>& h) {...}
}
}
}

// Translation unit
#include N.h
#include 3.h
#include 2.h //in this order

A::B::C::make(...)

The overload resolution is done on the Head<n>&, Head<2>&, Head<3>...

Is it sensitive to order of inclusion?

rds,


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net