Skip to content

Instantly share code, notes, and snippets.

/// from e-maxx.ru
typedef struct node
{
int val,prior,size;
struct node *l,*r;
} node;
typedef node* pnode;
/// from e-maxx.ru
typedef struct node{
int prior,size;
int val;//value stored in the array
int sum;//whatever info you want to maintain in segtree for each node
int lazy;//whatever lazy update you want to do
struct node *l,*r;
}node;
typedef node* pnode;
class X {
X(Sometype); // "ordinary constructor"
X(); // default constructor
X(const X&); // copy constructor
X(X&&); // move constructor
X& operator=(const X&); // copy assignment: clean up target and copy
X& operator=(X&&); // move assignment: clean up target and move
~X(); // destructor: clean up
// ...
};
#include <iostream>
#include <vector>
#include <ctime>
#include <sstream>
#include <iomanip>
int main()
{
@den385
den385 / boost_irange.cpp
Last active April 30, 2018 10:19
boost push_back & irange
size_t columns_count;
std::vector<size_t> columns;
boost::push_back(columns, boost::irange<size_t>(0, columns_count));
@cybertxt
cybertxt / spinlock.h
Last active September 23, 2021 06:13
spinlock in c++11 based on atomic_flag
#ifndef _SPINLOCK_H_20170410_
#define _SPINLOCK_H_20170410_
#include <atomic>
class spinlock {
public:
spinlock() { m_lock.clear(); }
spinlock(const spinlock&) = delete;
~spinlock() = default;