Skip to content

Instantly share code, notes, and snippets.

@jbandela
jbandela / slist.hpp
Last active February 3, 2024 00:03
Atomic singly linked list
#include <atomic>
#include <memory>
#include <iterator>
#include <utility>
#include <assert.h>
//
// Lock free singly-linked using shared_ptr (if atomic_* for shared_ptr is lock_free)
// You can get the head, and push_front
// You can replace the head
@jbandela
jbandela / cargo_x86_64-unknown-linux-gnu-on-m1-mac.sh
Created February 15, 2023 19:42 — forked from shqld/cargo_x86_64-unknown-linux-gnu-on-m1-mac.sh
cargo build for the target x86_64-unknown-linux-gnu on M1 Mac
# https://github.com/messense/homebrew-macos-cross-toolchains
brew tap messense/macos-cross-toolchains
brew install x86_64-unknown-linux-gnu
export CC_X86_64_UNKNOWN_LINUX_GNU=x86_64-unknown-linux-gnu-gcc
export CXX_X86_64_UNKNOWN_LINUX_GNU=x86_64-unknown-linux-gnu-g++
export AR_X86_64_UNKNOWN_LINUX_GNU=x86_64-unknown-linux-gnu-ar
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-unknown-linux-gnu-gcc
@jbandela
jbandela / polymorphic_view.cpp
Last active August 10, 2018 23:28
Polymorphic View
// Copyright 2018 Google LLC.
// SPDX-License-Identifier: Apache-2.0
#include <array>
#include <utility>
namespace polymorphic {
namespace detail {
template <typename T, typename Signature>
struct function_entry;
//Copyright 2017 Google Inc.
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//https ://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
#include <iostream>
#include <typeinfo>
// Would go into operator_auto.hpp
namespace operator_auto {
struct operator_auto_imp {
template <class T>
@jbandela
jbandela / capturemymove1.cpp
Created December 4, 2012 21:29
Capture by Move Lambda - C++11
#include <utility>
#include <iostream>
#include <memory>
#include <type_traits>
#include <functional>
template<class T>
using moved_value = std::reference_wrapper<T>;
template<class T,class F>
@jbandela
jbandela / QT5.2
Last active December 27, 2015 06:49
How to build QT 5.2 with MSVC 2013 Release Static
1) Download
2) extract zip file
3) set DXSDK_DIR= \um\
4) Edit "C:\Users\jrb\Downloads\qt-everywhere-opensource-src-5.2.0-beta1\qt-everywhere-opensource-src-5.2.0-beta1\qtbase\mkspecs\win32-msvc2013\qmake.conf" and change MT to MD
5) C:\Users\jrb\Downloads\qt-everywhere-opensource-src-5.2.0-beta1\qt-everywhere-opensource-src-5.2.0-beta1\qtbase\src\angle\src\libGLESv2\Makefile.Release and replace "c:\program files ..\fxc" with fxc
6) C:\Users\jrb\Downloads\qt-everywhere-opensource-src-5.2.0-beta1\qt-everywhere-opensource-src-5.2.0-beta1\qtbase\src\3rdparty\angle\src\libEGL\Surface.cpp add #include <algorithm>
7) In "C:\Users\jrb\Downloads\qt-everywhere-opensource-src-5.2.0-beta1\qt-everywhere-opensource-src-5.2.0-beta1\qtdeclarative\src\3rdparty\masm\yarr\YarrParser.h"
Add definitions for declarations from C:\Users\jrb\Downloads\qt-everywhere-opensource-src-5.2.0-beta1\qt-everywhere-opensource-src-5.2.0-beta1
\qtscript\src\3rdparty\javascriptcore\JavaScriptCore\yarr\RegexCompiler.cpp
#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>
#include <cppcomponents_libuv/cppcomponents_libuv.hpp>
#include<vector>
using namespace cppcomponents_libuv;
using namespace cppcomponents;
#include <memory>
#include <string>
#include <iostream>
struct Base{
protected:
#include <iostream>
#include <cds/container/cuckoo_map.h>
#include <string>
#include <utility>
struct hash1 {
size_t operator()(std::string const& s) const
{