Skip to content

Instantly share code, notes, and snippets.

View Nekotekina's full-sized avatar

Ivan Nekotekina

  • Russian Federation, Moscow region
View GitHub Profile
@Nekotekina
Nekotekina / main.c
Created June 18, 2021 14:03
fs_bdvd test: check various flags in cellFsOpen
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cell/sysmodule.h>
#include <sysutil/sysutil_sysparam.h>
#include <sysutil/sysutil_msgdialog.h>
#include <sysutil/sysutil_syscache.h>
#include <sys/paths.h>
#include <cell/cell_fs.h>
@Nekotekina
Nekotekina / constexpr_arg.md
Last active September 8, 2019 14:36
Operator consteval(), constexpr function argument, and constexpr NSDM

Proposal

void foo(constexpr int x)
{
  // foo() is a function template with a hidden invented template parameter naming a unique type
  if constexpr ( consteval(x) )
  {
    // Should be legal in this scope
    std::bitset<x> z;
@Nekotekina
Nekotekina / const_v.hpp
Created September 20, 2018 14:09
const_v<> template variable
// Helper template
template <auto V>
struct const_value
{
static constexpr auto value = V;
constexpr operator decltype(V)() const noexcept
{
return V;
}
@Nekotekina
Nekotekina / bound_class_templates.md
Last active January 17, 2019 00:03
Bound Class Templates Proposal

Bound Class Templates

Introduction

Bound class - a class that has direct access to non-static members of some outer class and knows its own location within this outer class. Whether it can access private or protected members of the outer class, is governed by existing friendship rules. The only proposed way a bound class can be defined and instantiated is through a bound class template. Non-template bound classes are not proposed.

Outer class - a class that has a member or a base class which is a bound class. An outer class itself can be a bound class, or a normal class. This term does not imply anything special.

Bound class template - a class template whose template parameter list has a special parameter, with special syntax. The presence of this template parameter turns a normal class template into a bound class template.

@Nekotekina
Nekotekina / property-cxx17.hxx
Last active September 29, 2018 18:52
Property examples
// Helper type to examine pointers to members
template <typename MemPtrType>
struct memptr_traits
{
static_assert(std::is_member_pointer_v<MemPtrType>, "Not a member pointer");
};
// Pointer to data member specialization
template <typename Base, typename Type>
struct memptr_traits<Type Base::*>
@Nekotekina
Nekotekina / gist:0fd8e112b5b71a043f0c
Last active August 29, 2015 14:20
CgBinaryDisasm::FormatDisAsm attempt
std::string CgBinaryDisasm::FormatDisAsm(const std::string& code)
{
const std::pair<std::string, std::function<std::string()>> repl_list[] =
{
{ "$$", [this]{ return "$"; } }, // may require std::string("$")
{ "$0", [this]{ return GetSrcDisAsm<SRC0>(src0); } },
{ "$1", [this]{ return GetSrcDisAsm<SRC1>(src1); } },
{ "$2", [this]{ return GetSrcDisAsm<SRC2>(src2); } },
{ "$t", [this]{ return AddTexDisAsm(); } },
{ "$m", [this]{ return GetMask(); } },