There is a C++ std:: function minmax_element which returns the 'position' of the min and max elements - based upon iterators. See
http://www.cplusplus.com/reference/algorithm/minmax_element/
For an array, std::begin() and std::end() return the begin and end iterator. To get the position in the array, subtract the returned value from std::begin().
const auto [minpos, maxpos] {...} is a structured binding (requires C++17) that enables the returned pair from minmax_element() to directly set the values of minpos and maxpos and also deduce their type.
dup is an array that has an index of the number entered. If the element is true, the number has already been entered. If false then it's a unique number so set element to true.
std::cout in this context effectively returns true. std::cin effectively returns false if a number hasn't been entered, so !std:cin gives true if a number hasn't been entered. So for a bad number, true && true gives true, so the body of the while loop is entered. If the && is false - a number has been entered - then it is checked to see if < minum or > maxnum or is a duplicate. if any of these is true, the body of the while loop is entered.
The while loop body first displays a message. If the problem was that something other than a number was entered, then the std::cin stream state is set to fail. This needs to be reset using .clear(). Also any chars remaining in the stream need to be removed so that they are not used again - hence .ignore() which removes and ignores all remaining stream chars up-to and including a '\n'.
Hope that helps.