Compile-time “opposite” of std::less?










-1















Apologies in advance. I'm having a bit of difficulty finding the right phrasing for this question...



As an exercise, I'm working on a fixed-size priority queue that throws away objects greater than the max (for a queue finding the X smallest object) and throws away objects less than min (for queue holding the largest X objects). The question is whether there is way of arriving at the logical "opposite" of the comparator at compile-time.



See commented line in the code below:



template <
typename T,
typename Container = std::vector<T>,
typename Compare = std::less<typename Container::value_type>>
class fixed_size_priority_queue : public std::priority_queue<T, Container, Compare>

typename Container::size_type maxSize;
using base = std::priority_queue<T, Container, Compare>;

public:
fixed_size_priority_queue(std::size_t size) : base(), maxSize(size)

base::c.reserve(size);

void push(T value)

if (base::size() < maxSize)

base::push(value);

// is there some way of arriving at compile-time opposite of 'comp'?
else if (!base::comp(base::top(), value))

while (base::size() >= maxSize)

base::pop();

base::push(value);


;

void test_fixedPriQueue()


using smallestInts = fixed_size_priority_queue<int>;
smallestInts fq(4);
fq.push(5);
fq.push(3);
fq.push(5);
fq.push(5);
fq.push(7);
fq.push(11);
fq.push(1);
fq.push(2);


int main(int argc, char const *argv)

test_fixedPriQueue();
return 0;



I've simply used the not (!) operator to get the job done, but would this incur an, albeit very small, runtime cost? Is there a way to arrive at std::greater_equal when my class uses Compare = std::less?



I was hoping to use something like std::not<Compare> which would resolve to std::greater_equal when the Compare template parameter is std::less. Does that make sense?



** edit **



Trying the suggestion from sergeyA yielded what I was looking for:



template<typename T, typename Comparison>
struct logical_opposite

using op = void;
;

template <typename T>
struct logical_opposite<T, std::less<T>>

using op = std::greater_equal<T>;
;

template <typename T>
struct logical_opposite<T, std::greater<T>>

using op = std::less_equal<T>;
;


Then in the class derived from priority_queue, instantiate the logical opposite function object and use it when pushing into the queue:



//...
typename logical_opposite<T, Compare>::op not_comp;

public:
fixed_size_priority_queue(std::size_t size) : base(), maxSize(size), not_comp()
//....


There is a logical relationship between the comparison functor types and I was hoping that relationship was expressed in the STL.










share|improve this question
























  • std::not1(base::comp)?

    – YSC
    Nov 14 '18 at 16:08







  • 1





    Even if there would be some miniscule overhead (with optimizations there could be none), I'm not seeing how you can get greater_equal from less without a !. This seems like a textbook premature optimization, to be honest.

    – HolyBlackCat
    Nov 14 '18 at 16:08






  • 1





    @YSC I did see this, but noticed it is deprecated and soon to be obsolete.

    – veefu
    Nov 14 '18 at 16:13











  • And for a good reason: it's been made obsolete since lambdas.

    – YSC
    Nov 14 '18 at 16:16






  • 2





    You can create a templatized trait, which would select the opposite version based on the template argument, and specify each conversion. Tedious, and likely no quantifiable performance benefit.

    – SergeyA
    Nov 14 '18 at 16:17















-1















Apologies in advance. I'm having a bit of difficulty finding the right phrasing for this question...



As an exercise, I'm working on a fixed-size priority queue that throws away objects greater than the max (for a queue finding the X smallest object) and throws away objects less than min (for queue holding the largest X objects). The question is whether there is way of arriving at the logical "opposite" of the comparator at compile-time.



See commented line in the code below:



template <
typename T,
typename Container = std::vector<T>,
typename Compare = std::less<typename Container::value_type>>
class fixed_size_priority_queue : public std::priority_queue<T, Container, Compare>

typename Container::size_type maxSize;
using base = std::priority_queue<T, Container, Compare>;

public:
fixed_size_priority_queue(std::size_t size) : base(), maxSize(size)

base::c.reserve(size);

void push(T value)

if (base::size() < maxSize)

base::push(value);

// is there some way of arriving at compile-time opposite of 'comp'?
else if (!base::comp(base::top(), value))

while (base::size() >= maxSize)

base::pop();

base::push(value);


;

void test_fixedPriQueue()


using smallestInts = fixed_size_priority_queue<int>;
smallestInts fq(4);
fq.push(5);
fq.push(3);
fq.push(5);
fq.push(5);
fq.push(7);
fq.push(11);
fq.push(1);
fq.push(2);


int main(int argc, char const *argv)

test_fixedPriQueue();
return 0;



I've simply used the not (!) operator to get the job done, but would this incur an, albeit very small, runtime cost? Is there a way to arrive at std::greater_equal when my class uses Compare = std::less?



I was hoping to use something like std::not<Compare> which would resolve to std::greater_equal when the Compare template parameter is std::less. Does that make sense?



** edit **



Trying the suggestion from sergeyA yielded what I was looking for:



template<typename T, typename Comparison>
struct logical_opposite

using op = void;
;

template <typename T>
struct logical_opposite<T, std::less<T>>

using op = std::greater_equal<T>;
;

template <typename T>
struct logical_opposite<T, std::greater<T>>

using op = std::less_equal<T>;
;


Then in the class derived from priority_queue, instantiate the logical opposite function object and use it when pushing into the queue:



//...
typename logical_opposite<T, Compare>::op not_comp;

public:
fixed_size_priority_queue(std::size_t size) : base(), maxSize(size), not_comp()
//....


There is a logical relationship between the comparison functor types and I was hoping that relationship was expressed in the STL.










share|improve this question
























  • std::not1(base::comp)?

    – YSC
    Nov 14 '18 at 16:08







  • 1





    Even if there would be some miniscule overhead (with optimizations there could be none), I'm not seeing how you can get greater_equal from less without a !. This seems like a textbook premature optimization, to be honest.

    – HolyBlackCat
    Nov 14 '18 at 16:08






  • 1





    @YSC I did see this, but noticed it is deprecated and soon to be obsolete.

    – veefu
    Nov 14 '18 at 16:13











  • And for a good reason: it's been made obsolete since lambdas.

    – YSC
    Nov 14 '18 at 16:16






  • 2





    You can create a templatized trait, which would select the opposite version based on the template argument, and specify each conversion. Tedious, and likely no quantifiable performance benefit.

    – SergeyA
    Nov 14 '18 at 16:17













-1












-1








-1








Apologies in advance. I'm having a bit of difficulty finding the right phrasing for this question...



As an exercise, I'm working on a fixed-size priority queue that throws away objects greater than the max (for a queue finding the X smallest object) and throws away objects less than min (for queue holding the largest X objects). The question is whether there is way of arriving at the logical "opposite" of the comparator at compile-time.



See commented line in the code below:



template <
typename T,
typename Container = std::vector<T>,
typename Compare = std::less<typename Container::value_type>>
class fixed_size_priority_queue : public std::priority_queue<T, Container, Compare>

typename Container::size_type maxSize;
using base = std::priority_queue<T, Container, Compare>;

public:
fixed_size_priority_queue(std::size_t size) : base(), maxSize(size)

base::c.reserve(size);

void push(T value)

if (base::size() < maxSize)

base::push(value);

// is there some way of arriving at compile-time opposite of 'comp'?
else if (!base::comp(base::top(), value))

while (base::size() >= maxSize)

base::pop();

base::push(value);


;

void test_fixedPriQueue()


using smallestInts = fixed_size_priority_queue<int>;
smallestInts fq(4);
fq.push(5);
fq.push(3);
fq.push(5);
fq.push(5);
fq.push(7);
fq.push(11);
fq.push(1);
fq.push(2);


int main(int argc, char const *argv)

test_fixedPriQueue();
return 0;



I've simply used the not (!) operator to get the job done, but would this incur an, albeit very small, runtime cost? Is there a way to arrive at std::greater_equal when my class uses Compare = std::less?



I was hoping to use something like std::not<Compare> which would resolve to std::greater_equal when the Compare template parameter is std::less. Does that make sense?



** edit **



Trying the suggestion from sergeyA yielded what I was looking for:



template<typename T, typename Comparison>
struct logical_opposite

using op = void;
;

template <typename T>
struct logical_opposite<T, std::less<T>>

using op = std::greater_equal<T>;
;

template <typename T>
struct logical_opposite<T, std::greater<T>>

using op = std::less_equal<T>;
;


Then in the class derived from priority_queue, instantiate the logical opposite function object and use it when pushing into the queue:



//...
typename logical_opposite<T, Compare>::op not_comp;

public:
fixed_size_priority_queue(std::size_t size) : base(), maxSize(size), not_comp()
//....


There is a logical relationship between the comparison functor types and I was hoping that relationship was expressed in the STL.










share|improve this question
















Apologies in advance. I'm having a bit of difficulty finding the right phrasing for this question...



As an exercise, I'm working on a fixed-size priority queue that throws away objects greater than the max (for a queue finding the X smallest object) and throws away objects less than min (for queue holding the largest X objects). The question is whether there is way of arriving at the logical "opposite" of the comparator at compile-time.



See commented line in the code below:



template <
typename T,
typename Container = std::vector<T>,
typename Compare = std::less<typename Container::value_type>>
class fixed_size_priority_queue : public std::priority_queue<T, Container, Compare>

typename Container::size_type maxSize;
using base = std::priority_queue<T, Container, Compare>;

public:
fixed_size_priority_queue(std::size_t size) : base(), maxSize(size)

base::c.reserve(size);

void push(T value)

if (base::size() < maxSize)

base::push(value);

// is there some way of arriving at compile-time opposite of 'comp'?
else if (!base::comp(base::top(), value))

while (base::size() >= maxSize)

base::pop();

base::push(value);


;

void test_fixedPriQueue()


using smallestInts = fixed_size_priority_queue<int>;
smallestInts fq(4);
fq.push(5);
fq.push(3);
fq.push(5);
fq.push(5);
fq.push(7);
fq.push(11);
fq.push(1);
fq.push(2);


int main(int argc, char const *argv)

test_fixedPriQueue();
return 0;



I've simply used the not (!) operator to get the job done, but would this incur an, albeit very small, runtime cost? Is there a way to arrive at std::greater_equal when my class uses Compare = std::less?



I was hoping to use something like std::not<Compare> which would resolve to std::greater_equal when the Compare template parameter is std::less. Does that make sense?



** edit **



Trying the suggestion from sergeyA yielded what I was looking for:



template<typename T, typename Comparison>
struct logical_opposite

using op = void;
;

template <typename T>
struct logical_opposite<T, std::less<T>>

using op = std::greater_equal<T>;
;

template <typename T>
struct logical_opposite<T, std::greater<T>>

using op = std::less_equal<T>;
;


Then in the class derived from priority_queue, instantiate the logical opposite function object and use it when pushing into the queue:



//...
typename logical_opposite<T, Compare>::op not_comp;

public:
fixed_size_priority_queue(std::size_t size) : base(), maxSize(size), not_comp()
//....


There is a logical relationship between the comparison functor types and I was hoping that relationship was expressed in the STL.







c++ templates template-meta-programming






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 22:48







veefu

















asked Nov 14 '18 at 16:03









veefuveefu

2,21911427




2,21911427












  • std::not1(base::comp)?

    – YSC
    Nov 14 '18 at 16:08







  • 1





    Even if there would be some miniscule overhead (with optimizations there could be none), I'm not seeing how you can get greater_equal from less without a !. This seems like a textbook premature optimization, to be honest.

    – HolyBlackCat
    Nov 14 '18 at 16:08






  • 1





    @YSC I did see this, but noticed it is deprecated and soon to be obsolete.

    – veefu
    Nov 14 '18 at 16:13











  • And for a good reason: it's been made obsolete since lambdas.

    – YSC
    Nov 14 '18 at 16:16






  • 2





    You can create a templatized trait, which would select the opposite version based on the template argument, and specify each conversion. Tedious, and likely no quantifiable performance benefit.

    – SergeyA
    Nov 14 '18 at 16:17

















  • std::not1(base::comp)?

    – YSC
    Nov 14 '18 at 16:08







  • 1





    Even if there would be some miniscule overhead (with optimizations there could be none), I'm not seeing how you can get greater_equal from less without a !. This seems like a textbook premature optimization, to be honest.

    – HolyBlackCat
    Nov 14 '18 at 16:08






  • 1





    @YSC I did see this, but noticed it is deprecated and soon to be obsolete.

    – veefu
    Nov 14 '18 at 16:13











  • And for a good reason: it's been made obsolete since lambdas.

    – YSC
    Nov 14 '18 at 16:16






  • 2





    You can create a templatized trait, which would select the opposite version based on the template argument, and specify each conversion. Tedious, and likely no quantifiable performance benefit.

    – SergeyA
    Nov 14 '18 at 16:17
















std::not1(base::comp)?

– YSC
Nov 14 '18 at 16:08






std::not1(base::comp)?

– YSC
Nov 14 '18 at 16:08





1




1





Even if there would be some miniscule overhead (with optimizations there could be none), I'm not seeing how you can get greater_equal from less without a !. This seems like a textbook premature optimization, to be honest.

– HolyBlackCat
Nov 14 '18 at 16:08





Even if there would be some miniscule overhead (with optimizations there could be none), I'm not seeing how you can get greater_equal from less without a !. This seems like a textbook premature optimization, to be honest.

– HolyBlackCat
Nov 14 '18 at 16:08




1




1





@YSC I did see this, but noticed it is deprecated and soon to be obsolete.

– veefu
Nov 14 '18 at 16:13





@YSC I did see this, but noticed it is deprecated and soon to be obsolete.

– veefu
Nov 14 '18 at 16:13













And for a good reason: it's been made obsolete since lambdas.

– YSC
Nov 14 '18 at 16:16





And for a good reason: it's been made obsolete since lambdas.

– YSC
Nov 14 '18 at 16:16




2




2





You can create a templatized trait, which would select the opposite version based on the template argument, and specify each conversion. Tedious, and likely no quantifiable performance benefit.

– SergeyA
Nov 14 '18 at 16:17





You can create a templatized trait, which would select the opposite version based on the template argument, and specify each conversion. Tedious, and likely no quantifiable performance benefit.

– SergeyA
Nov 14 '18 at 16:17












1 Answer
1






active

oldest

votes


















2














There is no observable difference between !< and >= on primitive types, so your fear of a runtime cost is ungrounded.



C++ is not assembly. It describes the behaviour of an abstract machine. Compilers map this to assembly, and operations that have no observable difference can be implemented identically in assembly.



While it takes some experience to learn what is "observable" in C++, the general rule is write clean code that avoids allocations when reasonable, keep da contiguous and keep O-notation speed sane, then test programs for performance problems before you worry about other issues.



!< vs >= is not one of the "avoid premature pessimisation" issues, so you should ignore it unless you find the code when profiling.






share|improve this answer























  • Perhaps mentioning a runtime cost at all has gotten away from what I really mean to ask. The question is whether there is a built-in way to deduce at that not (std::less) is more simply expressed as std::greater_equal at compile time.

    – veefu
    Nov 14 '18 at 17:23







  • 1





    "operations that have no observable difference can be implemented identically in assembly". It is theoretically possible, but there are a lot of occasions where the compiler doesn't do it. But you're right on the part that the extra negation usually doesn't cost anything, as it can be fused into some other operation.

    – geza
    Nov 14 '18 at 17:49











  • @veefu the comparator is passed in, so definitely not?

    – Yakk - Adam Nevraumont
    Nov 14 '18 at 17:53











  • @Yakk-AdamNevraumont I've added to the question a bit, which maybe clarifies the question, to some degree. You mention "observable differences on primative types". Why the qualified answer? What happens with more complicated user-defined types in such cases?

    – veefu
    Nov 14 '18 at 19:59










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',
autoActivateHeartbeat: false,
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%2f53304299%2fcompile-time-opposite-of-stdless%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














There is no observable difference between !< and >= on primitive types, so your fear of a runtime cost is ungrounded.



C++ is not assembly. It describes the behaviour of an abstract machine. Compilers map this to assembly, and operations that have no observable difference can be implemented identically in assembly.



While it takes some experience to learn what is "observable" in C++, the general rule is write clean code that avoids allocations when reasonable, keep da contiguous and keep O-notation speed sane, then test programs for performance problems before you worry about other issues.



!< vs >= is not one of the "avoid premature pessimisation" issues, so you should ignore it unless you find the code when profiling.






share|improve this answer























  • Perhaps mentioning a runtime cost at all has gotten away from what I really mean to ask. The question is whether there is a built-in way to deduce at that not (std::less) is more simply expressed as std::greater_equal at compile time.

    – veefu
    Nov 14 '18 at 17:23







  • 1





    "operations that have no observable difference can be implemented identically in assembly". It is theoretically possible, but there are a lot of occasions where the compiler doesn't do it. But you're right on the part that the extra negation usually doesn't cost anything, as it can be fused into some other operation.

    – geza
    Nov 14 '18 at 17:49











  • @veefu the comparator is passed in, so definitely not?

    – Yakk - Adam Nevraumont
    Nov 14 '18 at 17:53











  • @Yakk-AdamNevraumont I've added to the question a bit, which maybe clarifies the question, to some degree. You mention "observable differences on primative types". Why the qualified answer? What happens with more complicated user-defined types in such cases?

    – veefu
    Nov 14 '18 at 19:59















2














There is no observable difference between !< and >= on primitive types, so your fear of a runtime cost is ungrounded.



C++ is not assembly. It describes the behaviour of an abstract machine. Compilers map this to assembly, and operations that have no observable difference can be implemented identically in assembly.



While it takes some experience to learn what is "observable" in C++, the general rule is write clean code that avoids allocations when reasonable, keep da contiguous and keep O-notation speed sane, then test programs for performance problems before you worry about other issues.



!< vs >= is not one of the "avoid premature pessimisation" issues, so you should ignore it unless you find the code when profiling.






share|improve this answer























  • Perhaps mentioning a runtime cost at all has gotten away from what I really mean to ask. The question is whether there is a built-in way to deduce at that not (std::less) is more simply expressed as std::greater_equal at compile time.

    – veefu
    Nov 14 '18 at 17:23







  • 1





    "operations that have no observable difference can be implemented identically in assembly". It is theoretically possible, but there are a lot of occasions where the compiler doesn't do it. But you're right on the part that the extra negation usually doesn't cost anything, as it can be fused into some other operation.

    – geza
    Nov 14 '18 at 17:49











  • @veefu the comparator is passed in, so definitely not?

    – Yakk - Adam Nevraumont
    Nov 14 '18 at 17:53











  • @Yakk-AdamNevraumont I've added to the question a bit, which maybe clarifies the question, to some degree. You mention "observable differences on primative types". Why the qualified answer? What happens with more complicated user-defined types in such cases?

    – veefu
    Nov 14 '18 at 19:59













2












2








2







There is no observable difference between !< and >= on primitive types, so your fear of a runtime cost is ungrounded.



C++ is not assembly. It describes the behaviour of an abstract machine. Compilers map this to assembly, and operations that have no observable difference can be implemented identically in assembly.



While it takes some experience to learn what is "observable" in C++, the general rule is write clean code that avoids allocations when reasonable, keep da contiguous and keep O-notation speed sane, then test programs for performance problems before you worry about other issues.



!< vs >= is not one of the "avoid premature pessimisation" issues, so you should ignore it unless you find the code when profiling.






share|improve this answer













There is no observable difference between !< and >= on primitive types, so your fear of a runtime cost is ungrounded.



C++ is not assembly. It describes the behaviour of an abstract machine. Compilers map this to assembly, and operations that have no observable difference can be implemented identically in assembly.



While it takes some experience to learn what is "observable" in C++, the general rule is write clean code that avoids allocations when reasonable, keep da contiguous and keep O-notation speed sane, then test programs for performance problems before you worry about other issues.



!< vs >= is not one of the "avoid premature pessimisation" issues, so you should ignore it unless you find the code when profiling.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 14 '18 at 16:58









Yakk - Adam NevraumontYakk - Adam Nevraumont

187k20199384




187k20199384












  • Perhaps mentioning a runtime cost at all has gotten away from what I really mean to ask. The question is whether there is a built-in way to deduce at that not (std::less) is more simply expressed as std::greater_equal at compile time.

    – veefu
    Nov 14 '18 at 17:23







  • 1





    "operations that have no observable difference can be implemented identically in assembly". It is theoretically possible, but there are a lot of occasions where the compiler doesn't do it. But you're right on the part that the extra negation usually doesn't cost anything, as it can be fused into some other operation.

    – geza
    Nov 14 '18 at 17:49











  • @veefu the comparator is passed in, so definitely not?

    – Yakk - Adam Nevraumont
    Nov 14 '18 at 17:53











  • @Yakk-AdamNevraumont I've added to the question a bit, which maybe clarifies the question, to some degree. You mention "observable differences on primative types". Why the qualified answer? What happens with more complicated user-defined types in such cases?

    – veefu
    Nov 14 '18 at 19:59

















  • Perhaps mentioning a runtime cost at all has gotten away from what I really mean to ask. The question is whether there is a built-in way to deduce at that not (std::less) is more simply expressed as std::greater_equal at compile time.

    – veefu
    Nov 14 '18 at 17:23







  • 1





    "operations that have no observable difference can be implemented identically in assembly". It is theoretically possible, but there are a lot of occasions where the compiler doesn't do it. But you're right on the part that the extra negation usually doesn't cost anything, as it can be fused into some other operation.

    – geza
    Nov 14 '18 at 17:49











  • @veefu the comparator is passed in, so definitely not?

    – Yakk - Adam Nevraumont
    Nov 14 '18 at 17:53











  • @Yakk-AdamNevraumont I've added to the question a bit, which maybe clarifies the question, to some degree. You mention "observable differences on primative types". Why the qualified answer? What happens with more complicated user-defined types in such cases?

    – veefu
    Nov 14 '18 at 19:59
















Perhaps mentioning a runtime cost at all has gotten away from what I really mean to ask. The question is whether there is a built-in way to deduce at that not (std::less) is more simply expressed as std::greater_equal at compile time.

– veefu
Nov 14 '18 at 17:23






Perhaps mentioning a runtime cost at all has gotten away from what I really mean to ask. The question is whether there is a built-in way to deduce at that not (std::less) is more simply expressed as std::greater_equal at compile time.

– veefu
Nov 14 '18 at 17:23





1




1





"operations that have no observable difference can be implemented identically in assembly". It is theoretically possible, but there are a lot of occasions where the compiler doesn't do it. But you're right on the part that the extra negation usually doesn't cost anything, as it can be fused into some other operation.

– geza
Nov 14 '18 at 17:49





"operations that have no observable difference can be implemented identically in assembly". It is theoretically possible, but there are a lot of occasions where the compiler doesn't do it. But you're right on the part that the extra negation usually doesn't cost anything, as it can be fused into some other operation.

– geza
Nov 14 '18 at 17:49













@veefu the comparator is passed in, so definitely not?

– Yakk - Adam Nevraumont
Nov 14 '18 at 17:53





@veefu the comparator is passed in, so definitely not?

– Yakk - Adam Nevraumont
Nov 14 '18 at 17:53













@Yakk-AdamNevraumont I've added to the question a bit, which maybe clarifies the question, to some degree. You mention "observable differences on primative types". Why the qualified answer? What happens with more complicated user-defined types in such cases?

– veefu
Nov 14 '18 at 19:59





@Yakk-AdamNevraumont I've added to the question a bit, which maybe clarifies the question, to some degree. You mention "observable differences on primative types". Why the qualified answer? What happens with more complicated user-defined types in such cases?

– veefu
Nov 14 '18 at 19:59



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53304299%2fcompile-time-opposite-of-stdless%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo