Try to deal with C++11 (or not) compilers a little better, so we can avoid standard violation in foreign_ptr.hpp. Refs #6655.