E
Eelis
eelis.net · Personal blog · on HN since 2012
Eelis is a C++ programmer who writes about language tricks and maintains an HTML build of the C++ draft standard.
What HN saysHN commenters repeatedly cite his multi-dimensional analog literals as one of the most magnificent abuses of C++ operator overloading, and link his standard draft.
20HN people shared it
13linked it in comments
7stories submitted
107story points
3 years agolast shared
2012people per year2026
Most-shared posts
- 1Multi-Dimensional Analog Literals15 people · 107 points · first shared 2012 · 8 comments on HN
- 2Geordi3 people · first shared 2015
- 3Robots1 people · first shared 2015
- 4C draft1 people · first shared 2017
What HN people wrote when they linked it
Sharlin · 2024-03-24
One of the most magnificent abuses of operator overloading ever: multi-dimensional analog literals (http://www.eelis.net/C++/analogliterals.xhtml)
gpderetta · 2022-10-07
We do not have yet three dimensional white space overloading unfortunately, will have to wait for the next release train, targeting C++26.
In the meantime, you can use multidimensional analog literals: http://www.eelis.net/C++/analogliterals.xhtml
pjc50 · 2019-05-05
See "multi dimensional analog literals": http://www.eelis.net/C++/analogliterals.xhtml
Someone · 2019-03-07
Reminded me of http://www.eelis.net/C++/analogliterals.xhtml, which starts with
unsigned int a = 4;
unsigned int b = I---------I;
assert( a == b );
Moves on to 2D:
unsigned int c = ( o-----o
| !
! !
! !
o-----o ).area;
assert( c == (I-----I) * (I-------I) );
and puts the cherry on the cake with 3D literals:
assert( top( o-------o
|L \
| L \
| o-------o
| ! !
! ! !
o | !
L | !
L| !
o-------o ) == ( o-------o
| !
! !
o-------o ) );
m-ou-se · 2017-12-05
You can build the pdf yourself from the LaTeX source: https://github.com/cplusplus/draft
Or get the latest public draft from https://wg21.link/standard
Or an html version: http://eelis.net/c++draft/
TeMPOraL · 2017-07-13
Also, never forget, the C++ Multi-Dimensional Analog Literals:
assert( ( o-------------o
|L \
| L \
| L \
| o-------------o
| ! !
! ! !
o | !
L | !
L | !
L| !
o-------------o ).volume == ( o-------------o
| !
! !
! !
o-------------o ).area * int(I-------------I) );
http://www.eelis.net/C++/analogliterals.xhtml
jacobparker · 2017-06-28
Nicely done!
Different but similar joke for C++: http://www.eelis.net/C++/analogliterals.xhtml
PuercoPop · 2015-06-16
You can build a foolproof sandbox, but at the 'OS-level', not at the 'language' level. By disabling syscalls and setting resource limits.
You can read more here: http://www.eelis.net/geordi/#faq
mietek · 2015-04-01
Thanks. I’ve been looking for this for a while.
Why would anyone release their work into the public domain, and at the same time, disallow their site from being included in the Internet Archive?
http://eelis.net/robots.txt
jordigh · 2015-04-01
<Eelis> i could implement a "geordi, fix my code" command, and
still most people would remember me for those cursed analog
literals.
geordi is an IRC C++ bot that Eelis made in Haskell. It parses and runs C++:
http://www.eelis.net/geordi/
Since it actually can parse C++, it can be given C++ editing commands, although you have to know the C++ grammar in order to give it those commands.
vinkelhake · 2015-04-01
Eelis has also written the IRC bot geordi. The bot "evaluates" C++ snippets by compiling them with GCC (or clang), executing the resulting binary in a sandbox and pipes the output back to IRC. It's heavily used in C++ channels on multiple IRC networks.
http://www.eelis.net/geordi
zokier · 2014-10-07
Somehow I'm reminded of "Multi-Dimensional Analog Literals" project for C++:
assert( ( o-------------o
|L \
| L \
| L \
| o-------------o
| ! !
! ! !
o | !
L | !
L | !
L| !
o-------------o ).volume == ( o-------------o
| !
! !
! !
o-------------o ).area * int(I-------------I) );
http://www.eelis.net/C++/analogliterals.xhtml
Bjartr · 2012-11-22
It's certainly possible to get out of hand with operator overloading, especially if you try. Take this implementation of "analog literals" in C++
http://www.eelis.net/C++/analogliterals.xhtml