Skip to content

Instantly share code, notes, and snippets.

View vasalf's full-sized avatar

Vasily Alferov vasalf

  • Saint Petersburg
View GitHub Profile
@vasalf
vasalf / integer_set.cpp
Created November 24, 2019 13:59
Практика 10
#include <iostream>
#include <vector>
#include <algorithm>
class integer_set {
public:
using const_iterator = std::vector<int>::const_iterator;
integer_set() { }
@vasalf
vasalf / Makefile
Created December 6, 2019 22:19
Внутренний приватный класс
all: main
bin:
mkdir bin
bin/aclass.o: src/aclass.cpp | bin
g++ -c -g -Iinclude -std=c++11 src/aclass.cpp -o bin/aclass.o
bin/main.o: src/main.cpp | bin
g++ -c -g -Iinclude -std=c++11 src/main.cpp -o bin/main.o
@vasalf
vasalf / auto_ptr.cpp
Created December 6, 2019 22:21
Практика 11
#include <iostream>
struct point {
int x, y;
point() {
std::cout << "Construct " << this << std::endl;
}
~point() {
@vasalf
vasalf / comparable.cpp
Created December 6, 2019 22:22
Практика 12
#include <iostream>
#include <memory>
class Comparable {
public:
virtual int compareTo(const Comparable& other) const = 0;
};
class Int : public Comparable {
int value;
#include <algorithm>
#include <iostream>
#include <vector>
#include <boost/polygon/voronoi.hpp>
using namespace std;
using boost::polygon::voronoi_diagram;
using boost::polygon::voronoi_builder;
using boost::polygon::construct_voronoi;
module Lib where
import Control.Monad (replicateM)
someFunc :: IO ()
someFunc = undefined
a, b, m :: Int
a = 179
b = 239
@vasalf
vasalf / erase-remove.cpp
Created April 9, 2020 09:09
Tag dispatching, Erase-remove idiom & Mutable lambdas
#include <algorithm>
#include <iostream>
#include <vector>
struct T {
~T() {
std::cout << "destroy" << std::endl;
}
};
// У нас есть специализация
template<class T>
class vector {
};
template<>
class vector<bool> {