, ▁int ). ▁It ▁then ▁instanti ates ▁a ▁version ▁of ▁the ▁function ▁where ▁the ▁parameter izing ▁type ▁T ▁is ▁int , ▁making ▁the ▁equivalent ▁of ▁the ▁following ▁function : ▁ ▁int ▁max ( int ▁x , ▁int ▁y ) ▁{ ▁▁ ▁return ▁x ▁< ▁y ▁? ▁y ▁: ▁x ; ▁} ▁ ▁This ▁works ▁whether ▁the ▁arguments ▁x ▁and ▁y ▁are ▁integers , ▁strings , ▁or ▁any ▁other ▁type ▁for ▁which ▁the ▁expression ▁x ▁< ▁y ▁is ▁sensible , ▁or ▁more ▁specifically , ▁for ▁any ▁type ▁for ▁which ▁operator < ▁is ▁defined . ▁Common ▁inheritance ▁is ▁not ▁needed ▁for ▁the ▁set ▁of ▁types ▁that ▁can ▁be ▁used , ▁and ▁so ▁it ▁is ▁very ▁similar ▁to ▁du ck ▁typing . ▁A ▁program ▁defining ▁a ▁custom ▁data ▁type ▁can ▁use ▁operator ▁over loading ▁to ▁define ▁the ▁meaning ▁of ▁< ▁for ▁that ▁type , ▁thus ▁allowing ▁its ▁use ▁with ▁the ▁max () ▁function ▁template . ▁While ▁this ▁may ▁seem ▁a ▁minor ▁benefit ▁in ▁this ▁isolated ▁example , ▁in ▁the ▁context ▁of ▁a ▁compreh ensive ▁library ▁like ▁the ▁ST L ▁it ▁allows ▁the ▁programmer ▁to ▁get ▁extensive ▁functionality ▁for ▁a ▁new ▁data ▁type , ▁just ▁by ▁defining ▁a ▁few ▁operators ▁for ▁it . ▁Mer ely ▁defining ▁< ▁allows ▁a ▁type ▁to ▁be ▁used ▁with ▁the ▁standard ▁sort (), ▁stable _ sort (), ▁and ▁binary _ search () ▁algorithms ▁or ▁to ▁be ▁put ▁inside ▁data ▁structures ▁such ▁as ▁sets , ▁he aps , ▁and ▁associ ative ▁arrays . ▁ ▁C ++ ▁templates ▁are ▁completely ▁type ▁safe ▁at ▁compile