diff --git a/404.html b/404.html index 1b3a9b5..1d40fd6 100644 --- a/404.html +++ b/404.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - 404 - - + + + - diff --git a/about/index.html b/about/index.html index 6dec009..0cf506e 100644 --- a/about/index.html +++ b/about/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - About Me - - + + + - diff --git a/atom.xml b/atom.xml index 6247790..e1c200d 100644 --- a/atom.xml +++ b/atom.xml @@ -141,31 +141,51 @@

Sometimes you have a pointer to a class, and you want to invoke a method. You can use the -> operator for that.

So what do you do when you have a pointer to a method, and want to invoke it on a class? Use the <- operator!

#include <iostream>
- 
+
 template<class T>
 struct larrow {
     larrow(T* a_) : a(a_) { }
     T* a;
 };
- 
+
 template <class T, class R>
 R operator<(R (T::* f)(), larrow<T> it) {
     return (it.a->*f)();
 }
- 
+
 template<class T>
 larrow<T> operator-(T& a) {
     return larrow<T>(&a);
 }
- 
+
 struct C {
-    void f() { std::cout << "foo\n"; }    
+    void f() { std::cout << "foo\n"; }
 };
- 
+
 int main() {
     C x;
     (&C::f)<-x;
 }
+
+
+


+

Update: someone on Reddit complained about this being

+
+

a terrible idea because it becomes easy to confuse it with the <-- operator.

+
+

If you can get over the confusion (it should be easy: a lot of other operators also differ by only one character), both operators can be combined to write concise and efficient code:

+
struct C {
+  virtual void f(){ std::cout << "f\n"; }
+  virtual void g(){ std::cout << "g\n"; }
+  virtual void h(){ std::cout << "h\n"; }
+} x;
+
+int main(){
+    void(C::*(*a))() = 2 + *(void(C::*(**))())&x;
+    while(*(void**)&x <-- a){
+        (*a)<-x;
+    }
+}
]]> diff --git a/css/default.css b/css/default.css index 34a9524..a149603 100644 --- a/css/default.css +++ b/css/default.css @@ -1 +1 @@ -@import url("../font/font.css");@import url("reset.css");body{color:#070303;font-size:100%;margin:0px auto 0px auto;max-width:45em;font-family:dejavu-sans,sans-serif;background:#e0f0e4}div#content{background-color:#f6fffa;padding-left:1rem;padding-right:1rem}div#header{background-color:#f6fffa;border-bottom:2px solid black;padding:2ex 1.5em 2ex 1.5em;margin-top:0.5em}div#logo{color:black;float:left;font-size:1.2em;font-weight:bold;text-decoration:none}div#header #navigation{text-align:right}div#header #navigation a{color:black;font-size:0.8em;font-weight:bold;margin-left:1em;text-decoration:none;text-transform:uppercase;border:1px solid transparent;padding:2px}div#header #navigation a:hover{border:1px solid black}div#footer{background-color:#f6fffa;border-top:solid 2px black;color:#555;font-size:0.6em;padding:2ex 1.5em 2ex 1.5em;text-align:right}div#content{padding-top:2ex;padding-bottom:2ex}div#content p{text-align:justify}div#content li p{text-align:left}h1,h2,h3,h4{font-weight:bold}h1{font-size:1.5em;margin:0.2em 0em}h2{font-size:1.2em;margin:1em 0em}div.info{color:#555;font-size:0.8em;font-style:italic}pre{background-color:#f7faff;border:1px solid #e8f0ff;padding:5px 10px;font-family:dejavu-mono,monospace}p code{background-color:#f7faff;border:1px solid #e8f0ff;padding:2px 4px;font-family:dejavu-mono,monospace;font-size:80%}code.haskell{font-family:dejavu-sans,sans-serif}.sourceCode .kw{color:#268BD2}.sourceCode .dt{color:#268BD2}.sourceCode .dv,.sourceCode .bn,.sourceCode .fl{color:#D33682}.sourceCode .ch{color:#DC322F}.sourceCode .st{color:#2AA198}.sourceCode .co{color:#93A1A1}.sourceCode .ot{color:#A57800}.sourceCode .al{color:#CB4B16;font-weight:bold}.sourceCode .fu{color:#268BD2}.sourceCode .re{}.sourceCode .er{color:#D30102;font-weight:bold}a{text-decoration:none}a:hover{text-decoration:underline}pre,p,ul{margin:0.5em 0em;line-height:1.3em}ul{list-style:square outside;margin-left:0.5em}li{margin:0.5em 0em}li>p{}img{max-width:95%}pre{overflow:auto;font-size:0.9em}strong{font-weight:bold}em{font-style:italic} \ No newline at end of file +@import url("../font/font.css");@import url("reset.css");body{color:#070303;padding:0px;margin:0px auto 0px auto;max-width:55em;font-family:dejavu-sans,sans-serif;background:#e0f0e4;font-size:100%}div#content{background-color:#f6fffa;padding-top:2ex;padding-bottom:2ex;padding-left:max(1rem,5%);padding-right:max(1rem,5%)}div#header{background-color:#f6fffa;border-bottom:2px solid black;padding:2ex 1.5em 2ex 1.5em;margin-top:0.5em}div#logo{color:black;float:left;font-size:1.2em;font-weight:bold;text-decoration:none}div#header #navigation{text-align:right}div#header #navigation a{color:black;font-size:0.8em;font-weight:bold;margin-left:1em;text-decoration:none;text-transform:uppercase;border:1px solid transparent;padding:2px}div#header #navigation a:hover{border:1px solid black}div#footer{background-color:#f6fffa;border-top:solid 2px black;color:#555;font-size:0.6em;padding:2ex 1.5em 2ex 1.5em;text-align:right}div#content p{text-align:justify}div#content li p{text-align:left}h1,h2,h3,h4{font-weight:bold}h1{font-size:1.5em;margin:0.2em 0em}h2{font-size:1.2em;margin:1em 0em}div.info{color:#555;font-size:0.8em;font-style:italic}pre{background-color:#f7faff;border:1px solid #e8f0ff;padding:5px 10px;font-family:dejavu-mono,monospace}p code{background-color:#f7faff;border:1px solid #e8f0ff;padding:2px 4px;font-family:dejavu-mono,monospace;font-size:80%}code.haskell{font-family:dejavu-sans,sans-serif}.sourceCode .kw{color:#268BD2}.sourceCode .dt{color:#268BD2}.sourceCode .dv,.sourceCode .bn,.sourceCode .fl{color:#D33682}.sourceCode .ch{color:#DC322F}.sourceCode .st{color:#2AA198}.sourceCode .co{color:#93A1A1}.sourceCode .ot{color:#A57800}.sourceCode .al{color:#CB4B16;font-weight:bold}.sourceCode .fu{color:#268BD2}.sourceCode .re{}.sourceCode .er{color:#D30102;font-weight:bold}a{text-decoration:none}a:hover{text-decoration:underline}pre,p,ul{margin:0.5em 0em;line-height:1.3em}ul{list-style:square outside;margin-left:0.5em}li{margin:0.5em 0em}li>p{}img{max-width:95%}pre{overflow:auto;font-size:0.9em}strong{font-weight:bold}em{font-style:italic}blockquote{margin-left:0.2em;padding-left:0.5em;border-left:3px ridge #acc} \ No newline at end of file diff --git a/css/reset.css b/css/reset.css index 851c59d..1a7b3cb 100644 --- a/css/reset.css +++ b/css/reset.css @@ -1 +1 @@ -html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0} \ No newline at end of file +html,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0} \ No newline at end of file diff --git a/index.html b/index.html index caf4664..9e18d98 100644 --- a/index.html +++ b/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Articles - - + + + - diff --git a/p/cheating/index.html b/p/cheating/index.html index a274a43..368169a 100644 --- a/p/cheating/index.html +++ b/p/cheating/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Cheating - - + + + - diff --git a/p/cpp-bitand-nix/index.html b/p/cpp-bitand-nix/index.html index c799e8f..1a60aef 100644 --- a/p/cpp-bitand-nix/index.html +++ b/p/cpp-bitand-nix/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - C++ bitand Nix - - + + + - diff --git a/p/cross-compile-rethinkdb/index.html b/p/cross-compile-rethinkdb/index.html index 57ad296..5c95165 100644 --- a/p/cross-compile-rethinkdb/index.html +++ b/p/cross-compile-rethinkdb/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Cross compiling RethinkDB for ARM - - + + + - diff --git a/p/deferred-type-errors/index.html b/p/deferred-type-errors/index.html index 374271e..1ffea72 100644 --- a/p/deferred-type-errors/index.html +++ b/p/deferred-type-errors/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Deferred type errors in Haskell - - + + + - diff --git a/p/define-true-false/index.html b/p/define-true-false/index.html index f131ea8..fc8cc48 100644 --- a/p/define-true-false/index.html +++ b/p/define-true-false/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - #define true false - - + + + - diff --git a/p/experimenting-with-blender/index.html b/p/experimenting-with-blender/index.html index 5b73173..596e4f4 100644 --- a/p/experimenting-with-blender/index.html +++ b/p/experimenting-with-blender/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Experimenting with Blender - - + + + - diff --git a/p/guess-combinator/index.html b/p/guess-combinator/index.html index bc255f9..8bf8f5a 100644 --- a/p/guess-combinator/index.html +++ b/p/guess-combinator/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Guessing the implementation of combinators - - + + + - diff --git a/p/handwriting-n900/index.html b/p/handwriting-n900/index.html index 03b4e0b..8703625 100644 --- a/p/handwriting-n900/index.html +++ b/p/handwriting-n900/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Handwriting Recognition with CellWriter on the N900 - - + + + - diff --git a/p/haskell-nameless-parameters/index.html b/p/haskell-nameless-parameters/index.html index c968fe0..ac4148e 100644 --- a/p/haskell-nameless-parameters/index.html +++ b/p/haskell-nameless-parameters/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Writing Haskell Functions With Many Nameless Parameters - - + + + - diff --git a/p/haskell-rethinkdb-presentation/index.html b/p/haskell-rethinkdb-presentation/index.html index c6fba02..88a8579 100644 --- a/p/haskell-rethinkdb-presentation/index.html +++ b/p/haskell-rethinkdb-presentation/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Presentation on my RethinkDB driver for Haskell - - + + + - diff --git a/p/haxpuck/index.html b/p/haxpuck/index.html index 1f6294c..eb5d22d 100644 --- a/p/haxpuck/index.html +++ b/p/haxpuck/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Haxpuck - - + + + - diff --git a/p/ipfs-hosting/index.html b/p/ipfs-hosting/index.html index 24d2282..64fe222 100644 --- a/p/ipfs-hosting/index.html +++ b/p/ipfs-hosting/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Serving a website over IPFS - - + + + - diff --git a/p/kobo-deluxe/index.html b/p/kobo-deluxe/index.html index d8d6b58..e57c6aa 100644 --- a/p/kobo-deluxe/index.html +++ b/p/kobo-deluxe/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Kobo Deluxe - - + + + - diff --git a/p/loopy/index.html b/p/loopy/index.html index a09cca8..f05af90 100644 --- a/p/loopy/index.html +++ b/p/loopy/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Loopy - - + + + - diff --git a/p/minesweeper-89/index.html b/p/minesweeper-89/index.html index adff833..c0757c1 100644 --- a/p/minesweeper-89/index.html +++ b/p/minesweeper-89/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Minesweeper high score - - + + + - diff --git a/p/operator-larrow/index.html b/p/operator-larrow/index.html index 2453dc0..ebe37d2 100644 --- a/p/operator-larrow/index.html +++ b/p/operator-larrow/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - C++ left arrow operator - - + + + - diff --git a/p/rethinkdb-stream/index.html b/p/rethinkdb-stream/index.html index d0cc83f..3a55ed6 100644 --- a/p/rethinkdb-stream/index.html +++ b/p/rethinkdb-stream/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - Demo: video streaming with RethinkDB - - + + + - diff --git a/p/type-prelude/index.html b/p/type-prelude/index.html index 5face3e..218397a 100644 --- a/p/type-prelude/index.html +++ b/p/type-prelude/index.html @@ -1,11 +1,11 @@ - - + - + AtnNn.com - type-prelude and GHC 7.6.1 - - + + + -