Do we still need to write the empty angle brackets when using transparent std function objects?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
14
down vote

favorite
1












With class template argument deduction we can write:



std::less Fn;


However, G++ 8.2 rejects this code:



#include <algorithm>
#include <vector>
#include <functional>

int main()

std::vector v= 1, 3, 2, 7, 5, 4 ;

std::sort(v.begin(),v.end(),std::greater());



emitting the following error:



error: cannot deduce template arguments for 'greater' from ()


Clang++ 7.0 and MSVC 15.8.0 compile it without warnings. Which compiler is right?










share|improve this question



















  • 5




    interesting gcc compiles with std::greater
    – bolov
    59 mins ago










  • @bolov I have added the missing header
    – metalfox
    57 mins ago














up vote
14
down vote

favorite
1












With class template argument deduction we can write:



std::less Fn;


However, G++ 8.2 rejects this code:



#include <algorithm>
#include <vector>
#include <functional>

int main()

std::vector v= 1, 3, 2, 7, 5, 4 ;

std::sort(v.begin(),v.end(),std::greater());



emitting the following error:



error: cannot deduce template arguments for 'greater' from ()


Clang++ 7.0 and MSVC 15.8.0 compile it without warnings. Which compiler is right?










share|improve this question



















  • 5




    interesting gcc compiles with std::greater
    – bolov
    59 mins ago










  • @bolov I have added the missing header
    – metalfox
    57 mins ago












up vote
14
down vote

favorite
1









up vote
14
down vote

favorite
1






1





With class template argument deduction we can write:



std::less Fn;


However, G++ 8.2 rejects this code:



#include <algorithm>
#include <vector>
#include <functional>

int main()

std::vector v= 1, 3, 2, 7, 5, 4 ;

std::sort(v.begin(),v.end(),std::greater());



emitting the following error:



error: cannot deduce template arguments for 'greater' from ()


Clang++ 7.0 and MSVC 15.8.0 compile it without warnings. Which compiler is right?










share|improve this question















With class template argument deduction we can write:



std::less Fn;


However, G++ 8.2 rejects this code:



#include <algorithm>
#include <vector>
#include <functional>

int main()

std::vector v= 1, 3, 2, 7, 5, 4 ;

std::sort(v.begin(),v.end(),std::greater());



emitting the following error:



error: cannot deduce template arguments for 'greater' from ()


Clang++ 7.0 and MSVC 15.8.0 compile it without warnings. Which compiler is right?







c++ templates language-lawyer c++17 argument-deduction






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 36 mins ago









xskxzr

5,38081950




5,38081950










asked 1 hour ago









metalfox

1,344215




1,344215







  • 5




    interesting gcc compiles with std::greater
    – bolov
    59 mins ago










  • @bolov I have added the missing header
    – metalfox
    57 mins ago












  • 5




    interesting gcc compiles with std::greater
    – bolov
    59 mins ago










  • @bolov I have added the missing header
    – metalfox
    57 mins ago







5




5




interesting gcc compiles with std::greater
– bolov
59 mins ago




interesting gcc compiles with std::greater
– bolov
59 mins ago












@bolov I have added the missing header
– metalfox
57 mins ago




@bolov I have added the missing header
– metalfox
57 mins ago












2 Answers
2






active

oldest

votes

















up vote
8
down vote



accepted










GCC is wrong. There is already a bug report.



[dcl.type.simple]/2 says:




A type-specifier of the form typenameoptnested-name-specifieropttemplate-name is a placeholder for a deduced class type ([dcl.type.class.deduct]).




And [dcl.type.class.deduct]/2 says:




A placeholder for a deduced class type can also be used in the type-specifier-seq in the new-type-id or type-id of a new-expression, as the simple-type-specifier in an explicit type conversion (functional notation) ([expr.type.conv]), or as the type-specifier in the parameter-declaration of a template-parameter. A placeholder for a deduced class type shall not appear in any other context.




Such use is allowed.




[temp.arg]/4 describes the syntax error that a template-id is required but there is no <>. However here std::greater is not resolved as a template-id so that paragraph does not apply.






share|improve this answer






















  • Is this case an explicit type conversion (functional notation)?
    – metalfox
    43 mins ago






  • 1




    @metalfox Isn't it? [expr.type.conv]/1: "A simple-type-specifier or typename-specifier followed by a parenthesized optional expression-list or by a braced-init-list (the initializer) constructs a value of the specified type given the initializer. If the type is a placeholder for a deduced class type, it is replaced by the return type of the function selected by overload resolution for class template deduction for the remainder of this subclause."
    – xskxzr
    38 mins ago










  • I see. I didn't think of it as a type conversion
    – metalfox
    11 mins ago


















up vote
7
down vote













Clang and MSVC are correct. This should be well-formed because of the combination effect of implicitly-generated deduction guides (since C++17) and default template argument.



(emphasis mine)




When a function-style cast or declaration of a variable uses the name
of a primary class template C without an argument list as the type
specifier, deduction will proceed as follows:



  • If C is defined, for each constructor (or constructor template) Ci declared in the named primary template (if it is defined), a fictional
    function template Fi, is constructed, such that

    • template parameters of Fi are the template parameters of C followed (if Ci is a constructor template) by the template parameters
      of Ci (default template arguments are included too)

    • the function parameters of Fi are the constructor parameters

    • the return type of Fi is C followed by the template parameters of the class template enclosed in <>


  • If C is not defined or does not declare any constructors, an additional fictional function template is added, derived as above from
    a hypothetical constructor C()

  • In any case, an additional fictional function template derived as above from a hypothetical constructor C(C) is added, called the copy
    deduction candidate.

Template argument deduction and overload resolution is then performed
for initialization of a fictional object of hypothetical class type,
whose constructor signatures match the guides (except for return type)
for the purpose of forming an overload set, and the initializer is
provided by the context in which class template argument deduction was
performed, except that the first phase of list-initialization
(considering initializer-list constructors) is omitted if the
initializer list consists of a single expression of type (possibly
cv-qualified) U, where U is a specialization of C or a class derived
from a specialization of C.



These fictional constructors are public members of the hypothetical
class type. They are explicit if the guide was formed from an explicit
constructor. If overload resolution fails, the program is ill-formed.
Otherwise, the return type of the selected F template specialization
becomes the deduced class template specialization.




Given std::greater(), the implicitly-generated deduction guide is applied and the additional fictional function is selected at last. As the result of overload resolution the default argument void is applied, then the deduced type will be void. That means std::greater() should be same as writing std::greater<void>() or std::greater<>().




BTW: Gcc doesn't compile with std::greater(), but std::greater or std::greater g; are fine, it might be gcc's bug.






share|improve this answer






















  • I'm not sure... std::less L compiles just fine. It is even shown as an example in cppreference
    – metalfox
    58 mins ago










  • @songyuanyao you are right. cppreference doesn't show neither a ctor, nor a deduction guide. Haven't checked the standard.
    – bolov
    54 mins ago










  • @metalfox Yes it's weird, std::greater g; is fine too. I'll check the standard further.
    – songyuanyao
    52 mins ago










  • @bolov I edited my answer, it seems your thought that it's relevent to deduction guide is correct.
    – songyuanyao
    19 mins ago










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53114567%2fdo-we-still-need-to-write-the-empty-angle-brackets-when-using-transparent-std-fu%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
8
down vote



accepted










GCC is wrong. There is already a bug report.



[dcl.type.simple]/2 says:




A type-specifier of the form typenameoptnested-name-specifieropttemplate-name is a placeholder for a deduced class type ([dcl.type.class.deduct]).




And [dcl.type.class.deduct]/2 says:




A placeholder for a deduced class type can also be used in the type-specifier-seq in the new-type-id or type-id of a new-expression, as the simple-type-specifier in an explicit type conversion (functional notation) ([expr.type.conv]), or as the type-specifier in the parameter-declaration of a template-parameter. A placeholder for a deduced class type shall not appear in any other context.




Such use is allowed.




[temp.arg]/4 describes the syntax error that a template-id is required but there is no <>. However here std::greater is not resolved as a template-id so that paragraph does not apply.






share|improve this answer






















  • Is this case an explicit type conversion (functional notation)?
    – metalfox
    43 mins ago






  • 1




    @metalfox Isn't it? [expr.type.conv]/1: "A simple-type-specifier or typename-specifier followed by a parenthesized optional expression-list or by a braced-init-list (the initializer) constructs a value of the specified type given the initializer. If the type is a placeholder for a deduced class type, it is replaced by the return type of the function selected by overload resolution for class template deduction for the remainder of this subclause."
    – xskxzr
    38 mins ago










  • I see. I didn't think of it as a type conversion
    – metalfox
    11 mins ago















up vote
8
down vote



accepted










GCC is wrong. There is already a bug report.



[dcl.type.simple]/2 says:




A type-specifier of the form typenameoptnested-name-specifieropttemplate-name is a placeholder for a deduced class type ([dcl.type.class.deduct]).




And [dcl.type.class.deduct]/2 says:




A placeholder for a deduced class type can also be used in the type-specifier-seq in the new-type-id or type-id of a new-expression, as the simple-type-specifier in an explicit type conversion (functional notation) ([expr.type.conv]), or as the type-specifier in the parameter-declaration of a template-parameter. A placeholder for a deduced class type shall not appear in any other context.




Such use is allowed.




[temp.arg]/4 describes the syntax error that a template-id is required but there is no <>. However here std::greater is not resolved as a template-id so that paragraph does not apply.






share|improve this answer






















  • Is this case an explicit type conversion (functional notation)?
    – metalfox
    43 mins ago






  • 1




    @metalfox Isn't it? [expr.type.conv]/1: "A simple-type-specifier or typename-specifier followed by a parenthesized optional expression-list or by a braced-init-list (the initializer) constructs a value of the specified type given the initializer. If the type is a placeholder for a deduced class type, it is replaced by the return type of the function selected by overload resolution for class template deduction for the remainder of this subclause."
    – xskxzr
    38 mins ago










  • I see. I didn't think of it as a type conversion
    – metalfox
    11 mins ago













up vote
8
down vote



accepted







up vote
8
down vote



accepted






GCC is wrong. There is already a bug report.



[dcl.type.simple]/2 says:




A type-specifier of the form typenameoptnested-name-specifieropttemplate-name is a placeholder for a deduced class type ([dcl.type.class.deduct]).




And [dcl.type.class.deduct]/2 says:




A placeholder for a deduced class type can also be used in the type-specifier-seq in the new-type-id or type-id of a new-expression, as the simple-type-specifier in an explicit type conversion (functional notation) ([expr.type.conv]), or as the type-specifier in the parameter-declaration of a template-parameter. A placeholder for a deduced class type shall not appear in any other context.




Such use is allowed.




[temp.arg]/4 describes the syntax error that a template-id is required but there is no <>. However here std::greater is not resolved as a template-id so that paragraph does not apply.






share|improve this answer














GCC is wrong. There is already a bug report.



[dcl.type.simple]/2 says:




A type-specifier of the form typenameoptnested-name-specifieropttemplate-name is a placeholder for a deduced class type ([dcl.type.class.deduct]).




And [dcl.type.class.deduct]/2 says:




A placeholder for a deduced class type can also be used in the type-specifier-seq in the new-type-id or type-id of a new-expression, as the simple-type-specifier in an explicit type conversion (functional notation) ([expr.type.conv]), or as the type-specifier in the parameter-declaration of a template-parameter. A placeholder for a deduced class type shall not appear in any other context.




Such use is allowed.




[temp.arg]/4 describes the syntax error that a template-id is required but there is no <>. However here std::greater is not resolved as a template-id so that paragraph does not apply.







share|improve this answer














share|improve this answer



share|improve this answer








edited 31 mins ago

























answered 51 mins ago









xskxzr

5,38081950




5,38081950











  • Is this case an explicit type conversion (functional notation)?
    – metalfox
    43 mins ago






  • 1




    @metalfox Isn't it? [expr.type.conv]/1: "A simple-type-specifier or typename-specifier followed by a parenthesized optional expression-list or by a braced-init-list (the initializer) constructs a value of the specified type given the initializer. If the type is a placeholder for a deduced class type, it is replaced by the return type of the function selected by overload resolution for class template deduction for the remainder of this subclause."
    – xskxzr
    38 mins ago










  • I see. I didn't think of it as a type conversion
    – metalfox
    11 mins ago

















  • Is this case an explicit type conversion (functional notation)?
    – metalfox
    43 mins ago






  • 1




    @metalfox Isn't it? [expr.type.conv]/1: "A simple-type-specifier or typename-specifier followed by a parenthesized optional expression-list or by a braced-init-list (the initializer) constructs a value of the specified type given the initializer. If the type is a placeholder for a deduced class type, it is replaced by the return type of the function selected by overload resolution for class template deduction for the remainder of this subclause."
    – xskxzr
    38 mins ago










  • I see. I didn't think of it as a type conversion
    – metalfox
    11 mins ago
















Is this case an explicit type conversion (functional notation)?
– metalfox
43 mins ago




Is this case an explicit type conversion (functional notation)?
– metalfox
43 mins ago




1




1




@metalfox Isn't it? [expr.type.conv]/1: "A simple-type-specifier or typename-specifier followed by a parenthesized optional expression-list or by a braced-init-list (the initializer) constructs a value of the specified type given the initializer. If the type is a placeholder for a deduced class type, it is replaced by the return type of the function selected by overload resolution for class template deduction for the remainder of this subclause."
– xskxzr
38 mins ago




@metalfox Isn't it? [expr.type.conv]/1: "A simple-type-specifier or typename-specifier followed by a parenthesized optional expression-list or by a braced-init-list (the initializer) constructs a value of the specified type given the initializer. If the type is a placeholder for a deduced class type, it is replaced by the return type of the function selected by overload resolution for class template deduction for the remainder of this subclause."
– xskxzr
38 mins ago












I see. I didn't think of it as a type conversion
– metalfox
11 mins ago





I see. I didn't think of it as a type conversion
– metalfox
11 mins ago













up vote
7
down vote













Clang and MSVC are correct. This should be well-formed because of the combination effect of implicitly-generated deduction guides (since C++17) and default template argument.



(emphasis mine)




When a function-style cast or declaration of a variable uses the name
of a primary class template C without an argument list as the type
specifier, deduction will proceed as follows:



  • If C is defined, for each constructor (or constructor template) Ci declared in the named primary template (if it is defined), a fictional
    function template Fi, is constructed, such that

    • template parameters of Fi are the template parameters of C followed (if Ci is a constructor template) by the template parameters
      of Ci (default template arguments are included too)

    • the function parameters of Fi are the constructor parameters

    • the return type of Fi is C followed by the template parameters of the class template enclosed in <>


  • If C is not defined or does not declare any constructors, an additional fictional function template is added, derived as above from
    a hypothetical constructor C()

  • In any case, an additional fictional function template derived as above from a hypothetical constructor C(C) is added, called the copy
    deduction candidate.

Template argument deduction and overload resolution is then performed
for initialization of a fictional object of hypothetical class type,
whose constructor signatures match the guides (except for return type)
for the purpose of forming an overload set, and the initializer is
provided by the context in which class template argument deduction was
performed, except that the first phase of list-initialization
(considering initializer-list constructors) is omitted if the
initializer list consists of a single expression of type (possibly
cv-qualified) U, where U is a specialization of C or a class derived
from a specialization of C.



These fictional constructors are public members of the hypothetical
class type. They are explicit if the guide was formed from an explicit
constructor. If overload resolution fails, the program is ill-formed.
Otherwise, the return type of the selected F template specialization
becomes the deduced class template specialization.




Given std::greater(), the implicitly-generated deduction guide is applied and the additional fictional function is selected at last. As the result of overload resolution the default argument void is applied, then the deduced type will be void. That means std::greater() should be same as writing std::greater<void>() or std::greater<>().




BTW: Gcc doesn't compile with std::greater(), but std::greater or std::greater g; are fine, it might be gcc's bug.






share|improve this answer






















  • I'm not sure... std::less L compiles just fine. It is even shown as an example in cppreference
    – metalfox
    58 mins ago










  • @songyuanyao you are right. cppreference doesn't show neither a ctor, nor a deduction guide. Haven't checked the standard.
    – bolov
    54 mins ago










  • @metalfox Yes it's weird, std::greater g; is fine too. I'll check the standard further.
    – songyuanyao
    52 mins ago










  • @bolov I edited my answer, it seems your thought that it's relevent to deduction guide is correct.
    – songyuanyao
    19 mins ago














up vote
7
down vote













Clang and MSVC are correct. This should be well-formed because of the combination effect of implicitly-generated deduction guides (since C++17) and default template argument.



(emphasis mine)




When a function-style cast or declaration of a variable uses the name
of a primary class template C without an argument list as the type
specifier, deduction will proceed as follows:



  • If C is defined, for each constructor (or constructor template) Ci declared in the named primary template (if it is defined), a fictional
    function template Fi, is constructed, such that

    • template parameters of Fi are the template parameters of C followed (if Ci is a constructor template) by the template parameters
      of Ci (default template arguments are included too)

    • the function parameters of Fi are the constructor parameters

    • the return type of Fi is C followed by the template parameters of the class template enclosed in <>


  • If C is not defined or does not declare any constructors, an additional fictional function template is added, derived as above from
    a hypothetical constructor C()

  • In any case, an additional fictional function template derived as above from a hypothetical constructor C(C) is added, called the copy
    deduction candidate.

Template argument deduction and overload resolution is then performed
for initialization of a fictional object of hypothetical class type,
whose constructor signatures match the guides (except for return type)
for the purpose of forming an overload set, and the initializer is
provided by the context in which class template argument deduction was
performed, except that the first phase of list-initialization
(considering initializer-list constructors) is omitted if the
initializer list consists of a single expression of type (possibly
cv-qualified) U, where U is a specialization of C or a class derived
from a specialization of C.



These fictional constructors are public members of the hypothetical
class type. They are explicit if the guide was formed from an explicit
constructor. If overload resolution fails, the program is ill-formed.
Otherwise, the return type of the selected F template specialization
becomes the deduced class template specialization.




Given std::greater(), the implicitly-generated deduction guide is applied and the additional fictional function is selected at last. As the result of overload resolution the default argument void is applied, then the deduced type will be void. That means std::greater() should be same as writing std::greater<void>() or std::greater<>().




BTW: Gcc doesn't compile with std::greater(), but std::greater or std::greater g; are fine, it might be gcc's bug.






share|improve this answer






















  • I'm not sure... std::less L compiles just fine. It is even shown as an example in cppreference
    – metalfox
    58 mins ago










  • @songyuanyao you are right. cppreference doesn't show neither a ctor, nor a deduction guide. Haven't checked the standard.
    – bolov
    54 mins ago










  • @metalfox Yes it's weird, std::greater g; is fine too. I'll check the standard further.
    – songyuanyao
    52 mins ago










  • @bolov I edited my answer, it seems your thought that it's relevent to deduction guide is correct.
    – songyuanyao
    19 mins ago












up vote
7
down vote










up vote
7
down vote









Clang and MSVC are correct. This should be well-formed because of the combination effect of implicitly-generated deduction guides (since C++17) and default template argument.



(emphasis mine)




When a function-style cast or declaration of a variable uses the name
of a primary class template C without an argument list as the type
specifier, deduction will proceed as follows:



  • If C is defined, for each constructor (or constructor template) Ci declared in the named primary template (if it is defined), a fictional
    function template Fi, is constructed, such that

    • template parameters of Fi are the template parameters of C followed (if Ci is a constructor template) by the template parameters
      of Ci (default template arguments are included too)

    • the function parameters of Fi are the constructor parameters

    • the return type of Fi is C followed by the template parameters of the class template enclosed in <>


  • If C is not defined or does not declare any constructors, an additional fictional function template is added, derived as above from
    a hypothetical constructor C()

  • In any case, an additional fictional function template derived as above from a hypothetical constructor C(C) is added, called the copy
    deduction candidate.

Template argument deduction and overload resolution is then performed
for initialization of a fictional object of hypothetical class type,
whose constructor signatures match the guides (except for return type)
for the purpose of forming an overload set, and the initializer is
provided by the context in which class template argument deduction was
performed, except that the first phase of list-initialization
(considering initializer-list constructors) is omitted if the
initializer list consists of a single expression of type (possibly
cv-qualified) U, where U is a specialization of C or a class derived
from a specialization of C.



These fictional constructors are public members of the hypothetical
class type. They are explicit if the guide was formed from an explicit
constructor. If overload resolution fails, the program is ill-formed.
Otherwise, the return type of the selected F template specialization
becomes the deduced class template specialization.




Given std::greater(), the implicitly-generated deduction guide is applied and the additional fictional function is selected at last. As the result of overload resolution the default argument void is applied, then the deduced type will be void. That means std::greater() should be same as writing std::greater<void>() or std::greater<>().




BTW: Gcc doesn't compile with std::greater(), but std::greater or std::greater g; are fine, it might be gcc's bug.






share|improve this answer














Clang and MSVC are correct. This should be well-formed because of the combination effect of implicitly-generated deduction guides (since C++17) and default template argument.



(emphasis mine)




When a function-style cast or declaration of a variable uses the name
of a primary class template C without an argument list as the type
specifier, deduction will proceed as follows:



  • If C is defined, for each constructor (or constructor template) Ci declared in the named primary template (if it is defined), a fictional
    function template Fi, is constructed, such that

    • template parameters of Fi are the template parameters of C followed (if Ci is a constructor template) by the template parameters
      of Ci (default template arguments are included too)

    • the function parameters of Fi are the constructor parameters

    • the return type of Fi is C followed by the template parameters of the class template enclosed in <>


  • If C is not defined or does not declare any constructors, an additional fictional function template is added, derived as above from
    a hypothetical constructor C()

  • In any case, an additional fictional function template derived as above from a hypothetical constructor C(C) is added, called the copy
    deduction candidate.

Template argument deduction and overload resolution is then performed
for initialization of a fictional object of hypothetical class type,
whose constructor signatures match the guides (except for return type)
for the purpose of forming an overload set, and the initializer is
provided by the context in which class template argument deduction was
performed, except that the first phase of list-initialization
(considering initializer-list constructors) is omitted if the
initializer list consists of a single expression of type (possibly
cv-qualified) U, where U is a specialization of C or a class derived
from a specialization of C.



These fictional constructors are public members of the hypothetical
class type. They are explicit if the guide was formed from an explicit
constructor. If overload resolution fails, the program is ill-formed.
Otherwise, the return type of the selected F template specialization
becomes the deduced class template specialization.




Given std::greater(), the implicitly-generated deduction guide is applied and the additional fictional function is selected at last. As the result of overload resolution the default argument void is applied, then the deduced type will be void. That means std::greater() should be same as writing std::greater<void>() or std::greater<>().




BTW: Gcc doesn't compile with std::greater(), but std::greater or std::greater g; are fine, it might be gcc's bug.







share|improve this answer














share|improve this answer



share|improve this answer








edited 10 mins ago

























answered 1 hour ago









songyuanyao

87.3k10169230




87.3k10169230











  • I'm not sure... std::less L compiles just fine. It is even shown as an example in cppreference
    – metalfox
    58 mins ago










  • @songyuanyao you are right. cppreference doesn't show neither a ctor, nor a deduction guide. Haven't checked the standard.
    – bolov
    54 mins ago










  • @metalfox Yes it's weird, std::greater g; is fine too. I'll check the standard further.
    – songyuanyao
    52 mins ago










  • @bolov I edited my answer, it seems your thought that it's relevent to deduction guide is correct.
    – songyuanyao
    19 mins ago
















  • I'm not sure... std::less L compiles just fine. It is even shown as an example in cppreference
    – metalfox
    58 mins ago










  • @songyuanyao you are right. cppreference doesn't show neither a ctor, nor a deduction guide. Haven't checked the standard.
    – bolov
    54 mins ago










  • @metalfox Yes it's weird, std::greater g; is fine too. I'll check the standard further.
    – songyuanyao
    52 mins ago










  • @bolov I edited my answer, it seems your thought that it's relevent to deduction guide is correct.
    – songyuanyao
    19 mins ago















I'm not sure... std::less L compiles just fine. It is even shown as an example in cppreference
– metalfox
58 mins ago




I'm not sure... std::less L compiles just fine. It is even shown as an example in cppreference
– metalfox
58 mins ago












@songyuanyao you are right. cppreference doesn't show neither a ctor, nor a deduction guide. Haven't checked the standard.
– bolov
54 mins ago




@songyuanyao you are right. cppreference doesn't show neither a ctor, nor a deduction guide. Haven't checked the standard.
– bolov
54 mins ago












@metalfox Yes it's weird, std::greater g; is fine too. I'll check the standard further.
– songyuanyao
52 mins ago




@metalfox Yes it's weird, std::greater g; is fine too. I'll check the standard further.
– songyuanyao
52 mins ago












@bolov I edited my answer, it seems your thought that it's relevent to deduction guide is correct.
– songyuanyao
19 mins ago




@bolov I edited my answer, it seems your thought that it's relevent to deduction guide is correct.
– songyuanyao
19 mins ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53114567%2fdo-we-still-need-to-write-the-empty-angle-brackets-when-using-transparent-std-fu%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

List of Gilmore Girls characters

Confectionery