Разделить это (как и должно быть в любом случае):
// put in detail namespace/file or something in real code
template<class T, class T2>
struct foo_base
{
typedef foo<T, T2> foo_type;
typedef typename std::iterator_traits<T>::iterator_category category_type;
static const bool random_access = std::is_same<category_type,
std::random_access_iterator_tag>::value;
typedef typename std::conditional<random_access,
std::bidirectional_iterator_tag,
category_type>::type tag_type;
typedef bar<foo_type, tag_type>::type base_type;
}
template<class T, class T2>
struct foo :
foo_base<T, T2>::base_type
{};
Даже если не было повторного бита, вы все равно должны разделить его, чтобы отделить логику базового типа от фактического наследования базового типа.