You might be looking for the (much more verbose, mind you) std::iterator_traits
.
In particular, this resolves to typename std::iterator_traits<BIt>::value_type
.
I don't think there's much benefit to using it though, it's more verbose and relies on an extra include, <iterator>
. If you didn't want the temp variable you could very well just use decltype(*first)
.