This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| struct A { | |
| void put() { | |
| cout << "A" << endl; | |
| } | |
| virtual void vPut() { | |
| cout << "A" << endl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def rec_permutations(prefix, remaining): | |
| if len(remaining) == 1: | |
| yield prefix + remaining | |
| else: | |
| for e in remaining: | |
| new_remaining = remaining[:] # copy | |
| new_remaining.remove(e) | |
| for p in rec_permutations(prefix + [e], new_remaining): | |
| yield p | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template <typename TValue, typename TPred> | |
| BinarySearchTree<TValue, TPred>::BinarySearchTree() { | |
| //... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Model is interface; | |
| type Model_Reference is access all Model'Class; | |
| type Container is tagged record | |
| Contents : Model_Reference; | |
| end record; | |
| procedure Set_Model (Object : in out Container; Value : Model'Class) is | |
| begin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IPoint SetDistance (IPoint point, double newDistance) { | |
| return Dispatcher.Instance.CreatePoint (point.X, point.Y, point.Z, (float)newDistance, point.Heading); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def authenticated(func): | |
| def wrapped_func(): | |
| if 'userid' in session: | |
| return func(user=db_session.query(User).filter(User.id == session['userid']).one()) | |
| else: | |
| return redirect('/user/login') | |
| return wrapped_func | |
| @app.route('/') | |
| @authenticated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module earth() { | |
| sphere(r=2, $fn=200); | |
| } | |
| module chock() { | |
| polyhedron( | |
| points=[[0,0,2], [0,0,-2], [2,0.6,2], [2, 0.6, -2], [2, -0.6, 2], | |
| [2, -0.6, -2] ], | |
| triangles=[[0, 1, 2], [1, 3, 2], [0, 4, 1], [1, 4, 5], [2, 3, 5], [2, 5, 4], | |
| [0, 2, 4], [1, 5, 3]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // kernel | |
| typedef struct { | |
| int2 offset; | |
| int2 center; | |
| } viewport; | |
| kernel void renderkernel(viewport vp) { | |
| // just accessing the struct crashes | |
| int a = vp.offset; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| with Ada.Finalization; -- package import | |
| generic -- indent++ | |
| Foo : Integer; | |
| package Bar is -- indend--; indent++ | |
| package Child is -- indend++ | |
| type T is new Ada.Finalization.Controlled | |
| with null record; -- NO package import | |
| end Child; -- indend-- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| with Ada.Text_IO; | |
| procedure Test is | |
| type Int_Array is array (1 .. 64) of aliased Integer; | |
| subtype Index is Integer range 1 .. 4; | |
| type Ref_Element (Data : not null access Integer) is limited null record | |
| with Implicit_Dereference => Data; |