Skip to content

Instantly share code, notes, and snippets.

View carmel4a's full-sized avatar

Kamil Lewan carmel4a

View GitHub Profile
@carmel4a
carmel4a / Driver.cpp
Created August 5, 2018 16:14
Possible car AI fix (crossing teleporting)
class Samochod
{
TTrack* reserved;
TTrack* cur_track;
short preffered_dir;
}
class TTrack
{
bool nie_zmieniac;
}
<svg>
...
<path
style=""
id="some_id" />
...
</svg>
<body>
<img src="/some_svg_file.svg/#some_id">
class Button
{
Button();
virtual ~Button();
virtual void Pressed() =0;
}
class SomeButton : public Button
{
SomeButton();
@carmel4a
carmel4a / function.cpp
Created August 28, 2018 23:16
szalony templejt
template<typename T, ... Ts>
struct FunctionHandler
{
std::function<void(T, Ts)> handler;
}
@carmel4a
carmel4a / dowolna_fcja_w_polu.cpp
Last active September 1, 2018 09:17
Example of field in a class `Button`, where we may contain reference to any other class member function.
#include <iostream>
#include <functional>
// In "some classes" you wanna have some functions.
struct SomeClass
{
void f1( int a )
{
std::cout<< a << std::endl;
};
struct A()
{
A& get();
int member;
private:
A();
A& A( const A& ) = delete;
A& operator=( const A& ) = delete;
};
static bool get_next_byte( std::istream& stream, char&c, std::string& log_ )
{
if( !stream.eof() )
{
stream.get( c );
log_ += c;
return true;
}
return false;
}
#include <iostream>
namespace ModuleA
{
struct Config
{
static unsigned char ( * get_next_byte_function)(void);
};
unsigned char (*Config::get_next_byte_function)(void)
= []()-> unsigned char{ return '\0';};
@carmel4a
carmel4a / login.cpp
Last active September 10, 2018 21:38
#include <iostream>
int main()
{
int proba = 0;
const int max_prob = 3;
std::string login;
std::string haslo;
while( true )
{
struct A
{
int m;
int cm;
int mm;
chujowy_vector v;
};
// Check if first element `t` is less than `r`
template< class T >