Jump to content

Defining your own operators


Recommended Posts

this is possible in C++... just for the fact that operators are in the end functions, and nothing more than that

so use a function instead :)

Func _AlmostEqual($num1, $num2)

some code

return YourResult (True or False)

EndFunc

Cheers :idea:

oooh I'm so glad I'm learning c++ :party:

Edited by torels

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

Yeah, I'm aware that it is possible in C++.

I know that they are just functions but the code would be a lot more readable if I could make it an operator. I will have lots and lots of comparisons and an operator would just make it a lot nicer.

Link to comment
Share on other sites

well

when you are working with things the level of ~= something like _AlmosEqual(5,5.2) in its palce doesn't ruin your code so much you know :party:

nor does any other function if sufficently descriptive and clearly named :)

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

An operator wouldn't even be enough to satisfy an "almost equal" comparison, you would need to also specify a tolerance AND whether its absolute or relative.

surely

but with Operator Overloading (as schoel said) it would be possible :)

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

surely

but with Operator Overloading (as schoel said) it would be possible :)

Only if the tolerance is static and not user specified.

Operators only allow 1 operand on each side so how would I go about specifying a tolerance? You can't. Even in C++ this would be useless.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...