greater是class template,內部重載了運算子operator()。另外,函數物件的定義如下function objects are instances of a class with member operator() defined. this member function allows the object to be used with the same syntax as a function call.所以,greater的物件是函數物件。 greater(),呼叫了的預設建構函數,產生一個臨時物件。
意思是
greater<string>()
傳回一個呼叫預設建構子建構的函式物件greater是class template,內部重載了運算子operator()。另外,函數物件的定義如下function objects are instances of a class with member operator() defined. this member function allows the object to be used with the same syntax as a function call.所以,greater的物件是函數物件。 greater(),呼叫了的預設建構函數,產生一個臨時物件。