Skip to content

Instantly share code, notes, and snippets.

View Siapran's full-sized avatar
🐁

Katherine Miller Siapran

🐁
View GitHub Profile
#pragma once
#include "oled_gui.h"
template <typename T>
T clamped_sub(T lhs, T rhs)
{
return lhs > rhs ? lhs - rhs : 0;
}
template <const unsigned long VALID_MS,
local http = require("coro-http")
local discordia = require("discordia")
local client = discordia.Client()
local function starts_with( str, start )
return str:sub(1, #start) == start
end
local prefix = "!"
[siapran@siapran-linux Development]$ cd lager/
[siapran@siapran-linux lager]$ nix-shell
[nix-shell:~/Development/lager]$ mkdir build && cd build
[nix-shell:~/Development/lager/build]$ cmake ..
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /nix/store/cg650dmmsy2bmsbx1y5f8qqpjb5hr0g2-gcc-wrapper-7.3.0/bin/gcc
-- Check for working C compiler: /nix/store/cg650dmmsy2bmsbx1y5f8qqpjb5hr0g2-gcc-wrapper-7.3.0/bin/gcc -- works
namespace detail {
template <typename T> struct is_optional : std::false_type {};
template <typename T> struct is_optional<std::optional<T>> : std::true_type {};
template <typename T>
[[maybe_unused]] constexpr bool is_optional_v = is_optional<std::decay_t<T>>::value;
/**
* // I hate this
*
* void foo(std::optional<std::string> bar) {}
TEST_CASE("lenses, fallback")
{
auto first = at_i(0);
auto first_name = first | optlift(attr(&person::name)) | fallback("NULL");
auto v1 = immer::vector<person>{};
CHECK(view(first_name, v1) == "NULL");
CHECK(view(first_name, set(at_i(0), v1, person{{}, "foo"})) == "NULL");
v1 = v1.push_back({{}, "foo"});
#ifndef ANY_LENS_HPP
#define ANY_LENS_HPP
#include <lager/lenses.hpp>
#include <memory>
#include <utility>
#include <type_traits>
namespace detail {
std::optional<lager::cursor<Volume>> volumeCursorAt(
lager::cursor<VolumeTree> treeCursor, VolumeTree const &tree, int &index)
{
if (index == 0) {
return {treeCursor[&VolumeTree::volume]};
} else {
size_t i = 0;
for (auto const &child : tree.children) {
--index;
std::optional<lager::cursor<Volume>> res =
/[...]/lager/detail/xform_nodes.hpp:176: warning: ‘lager::detail::xform_cursor_node<zug::composed<zug::map_t<lager::zoom(LensT&&, const lager::writer_mixin<CursorTs>& ...) [with LensT = zug::composed<lager::lens::attr(Member) [with Member = Volume VolumeTree::*]::<lambda(auto:29&&)> >&; CursorTs = {lager::cursor_base<lager::detail::cursor_node<VolumeTree> >}]::<lambda(auto:47&& ...)> > >, lager::update(UpdateT&&) [with UpdateT = lager::zoom(LensT&&, const lager::writer_mixin<CursorTs>& ...) [with LensT = zug::composed<lager::lens::attr(Member) [with Member = Volume VolumeTree::*]::<lambda(auto:29&&)> >&; CursorTs = {lager::cursor_base<lager::detail::cursor_node<VolumeTree> >}]::<lambda(auto:48&&, auto:49&& ...)>]::<lambda(auto:43&&)>, zug::meta::pack<lager::detail::cursor_node<VolumeTree> >, lager::detail::cursor_node>’ has a field ‘lager::detail::xform_cursor_node<zug::composed<zug::map_t<lager::zoom(LensT&&, const lager::writer_mixin<CursorTs>& ...) [with LensT = zug::composed<lager::lens::attr(Member) [wit
struct VolumeVolumeRegistration;
struct VolumeTree {
Volume volume;
std::vector<VolumeVolumeRegistration> children;
size_t depth = 0;
};
struct VolumeVolumeRegistration {
Transform transform;
VolumeTree tree;
[include_dir]\include\tao\json\internal/pair.hpp(23): error C2903: 'default_key': symbol is neither a class template nor a function template
[cpp_file].cpp(1143): note: see reference to function template instantiation 'tao::json::internal::pair<Traits>::pair<T&>(U)' being compiled
with
[
Traits=tao::json::traits,
T=std::map<std::string,tao::json::basic_value<tao::json::traits>,std::less<void>,std::allocator<std::pair<const std::string,tao::json::basic_value<tao::json::traits>>>>,
U=std::map<std::string,tao::json::basic_value<tao::json::traits>,std::less<void>,std::allocator<std::pair<const std::string,tao::json::basic_value<tao::json::traits>>>> &
]
[cpp_file].cpp(1143): note: see reference to function template instantiation 'tao::json::internal::pair<Traits>::pair<T&>(U)' being compiled
with