id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 12081,the minmax creates dangling references too easily,anonymous,Marshall Clow,"First. minmax's example codes has created dangling references. {{{ boost::tuple result1 = boost::minmax(1, 0); //actual code boost::tuple result1 = boost::minmax(1, 0); //expected code }}} http://www.boost.org/doc/libs/1_60_0/libs/algorithm/minmax/index.html [[BR]] http://www.boost.org/doc/libs/1_60_0/libs/algorithm/minmax/example/minmax_ex.cpp [[BR]] Second. The design of minmax is unsuitable for that of C++11 era. Consider the following. {{{ auto tp = minmax(1,2); tp.get<0>(); // Undefined behavior }}} This code looks like fairy normal, but it causes undefined behavior. Since the minmax returns tuple, the 'auto tp' has dangling references. [[BR]] I think we should change the return type from tuple to tuple. See also: https://groups.google.com/a/isocpp.org/forum/#!topic/std-discussion/HLiJJBRNYSw",Bugs,new,To Be Determined,minmax,Boost 1.60.0,Problem,,,