Sergei Fedorov
aka zmij
If you can imagine it, you can achieve it.
If you can dream it, you can become it.
If you can imagine it, you can achieve it.
If you can dream it, you can become it.
My name is Sergei Fedorov, I am 41, I live in Moscow, Russia. I've got a beautiful wife and two adorable sons.
I'm a programmer, a motorcyclist, a sailor and a salsa dancer :)
I work for 20 years as a programmer, primarilly server-side C++/Linux programmer. For the last 12 years I'm a team lead. I've changed a lot of companies in my career. Currently I'm a team lead in game programming and I love it. If you are curious about my career, you can check out my Linkedin profile
I've started this site in June 2014 when working on my Trip Plotter project. It is written in JavaScript, and as I didn't have prior experience with JavaScript and other web-browser client-side stuff, I decided to start a technical blog where I will put down my notes, discoveries etc.
And as far as I have a site hosted, I will randomly post here my photos and other stuff.
05 Aug 2022 Handling Member Pointers in Template Args
I always forget how to handle member pointers in templates, so here is a recipe:
template <auto> // since C++17
struct my_template; // Primary template, no definition
template <typename Class, typename ResultType, ResultType Class::* Member>
struct my_template<Member> {
// optional type aliases
using class_type = Class;
using member_type = ResutlType;
static constexpr auto member = Member;
// code here
};
For C++20 a non-type concept (cannot be used instead of typename
) can be defined as follows:
template<auto P>
concept member_data_pointer = std::is_member_object_pointer_v<decltype(P)>;
template <auto P>
concept member_func_pointer = std::is_member_function_pointer_v<decltype(P)>;
How to use this concept to constrain templates:
// Constraining primary template
// Usable to constrain all specialisations to member data pointers
template <auto P>
requires member_data_pointer<P>
struct my_template;
template <auto P>
struct my_cool_template; // Primary template to handle both data and function members
// Constraining template specialisation to member data pointers
template <typename Class, typename ResultType, ResultType Class::* Member>
requires member_data_pointer<Member>
struct my_cool_template;
// Constraining template specialisation to member function pointers
template <typename Class, typename MemberType, typename... Args, MemberType (Class::*Member)(Args...)>
requires member_func_pointer<Member>
struct my_cool_template;
23 Apr 2020 Easy Join Zoom Meeting the Hard Way
I've got tons of zoom meetings every day, links to the meetings are in my calendar. Usually the flow is as follows:
23 Jan 2019 Why 'psst' namespace
Some time ago I was working in a studio named “Pushkin Game Studio” and at some point we decided to opensource some libraries that we developed for our projects and that don’t contain business-related code. At first we put all the code in namespace tip
, the codename for the project we were developing when we started the libaries. The namespace is still used in several libraries. Some libraries were too generic and we decided to put them into thier own namespaces. But later the project was closed, we started another one and the tip
namespace became totally irrelevant.
So the newer libraries used namespace psst
, which initially stood for PuShkin Studio Templates, as the first library using this namespace was a collection of metaprogramming utilities. I left the studio in August 2018, but I continue to support and develop the libraries as I love the sound the namespace is pronounced :)