I was answering this question. And I realized that I ran my mouth off when I didn't know what I was talking about.
So my question is this. Is it possible to merge these functions in to one? (don't worry that this is an exact duplicate of a function that already exists, I'm just using it as an example)
template <class iterType1, class iterType2, class boolPred>
bool equal(iterType1 begin, iterType1 end, it开发者_运维技巧erType2 e, boolPred pred){
    while(begin != end){
        if(!pred(*begin, *e))
            return false;
        ++begin;
        ++e;
    }
    return true;
}
template <class iterType1, class iterType2>
bool equal(iterType1 begin, iterType1 end, iterType2 e){
    return equal(begin, end, e, std::equal_to<decltype(*begin)>());
}
Furthermore, is re-using the code from the first in the second even possible without using C++0x features(decltype).
Is it possible to merge these functions in to one?
Sadly, no. You can't have a default template argument for a function template parameter and default function arguments cannot be used to deduce template arguments.
Is re-using the code from the first in the second even possible without using C++0x features?
Yes:  you can use std::iterator_traits<T>::value_type.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论