GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Categories
  • Newsletter
  • Submit
  • Login
  • Awesome C++
  • Serialization

This view

  • Original page
  • New address

GeezerVison is showing cpp.libhunt.com — Nameof C++ Alternatives - C++ Serialization | LibHunt

  • Subscribe
  • Submit
  • Categories
  • About
  • Login

Nameof C++

Nameof operator for modern C++, simply obtain the name of a variable, type, function, macro, and enum

Neargye logo
github.com    Source Code    Docs    Changelog
Suggest Changes
Take the C++ Developer Survey - About 6 minutes on the tools, libraries and AI you use with C++. You get the results by email. Take the survey »
Popularity
6.6
Growing
Activity
8.7
-
Stars 2,368
Watchers 35
Forks 127
Last Commit 12 days ago

Description

Header-only C++17 library provides nameof macros and functions to simply obtain the name of a variable, type, function, macro, and enum.

Before, you had to use string literals to refer to definitions, which is brittle when renaming code elements because tools do not know to check these string literals.

Programming language: C++
License: MIT License
Tags: Serialization     Nameof     Nameof-operator     Cpp17     С++17    
Latest version: v0.10.6

Nameof C++ alternatives and similar libraries

Based on the "Serialization" category.
Alternatively, view Nameof C++ alternatives based on common mentions on social networks and blogs.

  • protobuf

    10.0 9.9 L1 Nameof C++ VS protobuf
    Protocol Buffers - Google's data interchange format
    protocolbuffers logo
  • FlatBuffers

    9.6 8.0 L1 Nameof C++ VS FlatBuffers
    FlatBuffers: Memory Efficient Serialization Library
    google logo
  • SaaSHub - Software Alternatives and Reviews

    SaaSHub helps you find the best software and product alternatives
    Promo www.saashub.com
    SaaSHub Logo
  • Magic Enum C++

    8.3 8.7 Nameof C++ VS Magic Enum C++
    Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code
    Neargye logo
  • cereal

    8.1 4.6 L2 Nameof C++ VS cereal
    A C++11 library for serialization
    USCiLab logo
  • MessagePack

    7.8 2.7 L1 Nameof C++ VS MessagePack
    MessagePack implementation for C and C++ / msgpack.org[C/C++]
    msgpack logo
  • SimpleBinaryEncoding

    7.7 9.0 L1 Nameof C++ VS SimpleBinaryEncoding
    Simple Binary Encoding (SBE) - High Performance Message Codec
    aeron-io logo
  • protobuf-c

    7.5 0.0 L2 Nameof C++ VS protobuf-c
    Protocol Buffers implementation in C
    protobuf-c logo
  • Bond

    7.2 7.0 L3 Nameof C++ VS Bond
    DISCONTINUED. Bond was a cross-platform framework for working with schematized data. The open-source project ended on March 31, 2025.
    microsoft logo
  • Simple C++ Serialization & Reflection.

    6.5 6.6 Nameof C++ VS Simple C++ Serialization & Reflection.
    Cista is a simple, high-performance, zero-copy C++ serialization & reflection library.
    felixguendling logo
  • Bitsery

    5.4 5.0 Nameof C++ VS Bitsery
    Your binary serialization library
    fraillt logo
  • cppcodec

    4.7 0.0 L2 Nameof C++ VS cppcodec
    Header-only C++11 library to encode/decode base64, base64url, base32, base32hex and hex (a.k.a. base16) as specified in RFC 4648, plus Crockford's base32. MIT licensed with consistent, flexible API.
    tplgy logo
  • The IOD Library

    4.6 0.0 L2 Nameof C++ VS The IOD Library
    Meta programming utilities for C++14. Merged in matt-42/lithium
    matt-42 logo
  • smf

    4.6 0.0 Nameof C++ VS smf
    Fastest RPC in the west
    smfrpc logo
  • protozero

    4.4 7.2 L2 Nameof C++ VS protozero
    Minimalist protocol buffer decoder and encoder in C++
    mapbox logo
  • Boost.Serialization

    3.6 8.3 L3 Nameof C++ VS Boost.Serialization
    Boost.org serialization module
    boostorg logo
  • config-loader

    3.3 2.0 Nameof C++ VS config-loader
    Simple C++ Config Loader Framework(Serialization & Reflection)
    netcan logo
  • LeapSerial

    2.5 0.0 L4 Nameof C++ VS LeapSerial
    The Leap Motion cross-format, cross-platform declarative serialization library
    leapmotion logo
  • cppbor

    1.5 0.0 Nameof C++ VS cppbor
    An implementation of cbor using C++ 17 variants
    RantyDave logo
  • JsonFusion

    1.4 8.7 Nameof C++ VS JsonFusion
    Map structures to/from json
    tucher logo

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.

Do you think we are missing an alternative of Nameof C++ or a related project?

Add another 'Serialization' Library

Popular Comparisons

  • Nameof C++
    vs
    Magic Enum C++
  • Nameof C++
    vs
    smf
  • Nameof C++
    vs
    Bitsery
  • Nameof C++
    vs
    LeapSerial
  • Nameof C++
    vs
    The IOD Library

README

Stand With Ukraine

 _   _                             __    _____
| \ | |                           / _|  / ____|_     _
|  \| | __ _ _ __ ___   ___  ___ | |_  | |   _| |_ _| |_
| . ` |/ _` | '_ ` _ \ / _ \/ _ \|  _| | |  |_   _|_   _|
| |\  | (_| | | | | | |  __/ (_) | |   | |____|_|   |_|
|_| \_|\__,_|_| |_| |_|\___|\___/|_|    \_____|

Github releases Conan package Vcpkg package [License](LICENSE) Try online Compiler explorer

Nameof C++

Header-only C++17 library provides nameof macros and functions to simply obtain the name of a variable, type, function, macro, and enum.

Features

  • C++17
  • Header-only
  • Dependency-free
  • Compile-time
  • Name of variable, member variable
  • Name of type, variable type
  • Name of function, member function
  • Name of enum, enum variable
  • Name of macro
  • Enum to string

Documentation

  • [Reference](doc/reference.md)
  • [Limitations](doc/limitations.md)
  • Integration

[Examples](example/example.cpp)

  • Nameof
  // Name of variable.
  NAMEOF(somevar) -> "somevar"

  // Name of member variable.
  NAMEOF(person.address.zip_code) -> "zip_code"

  // Name of function.
  NAMEOF(foo<int, float>()) -> "foo"

  // Name of member function.
  NAMEOF(somevar.some_method()) -> "some_method"
  NAMEOF(somevar.some_method<int>()) -> "some_method"

  // Name of macro.
  NAMEOF(__LINE__) -> "__LINE__"
  NAMEOF(NAMEOF(structvar)) -> "NAMEOF"
  • Nameof enum
  enum class Color { RED = 1, BLUE = 2, GREEN = 4 };

  auto color = Color::RED;
  // Name of enum variable.
  NAMEOF_ENUM(color) -> "RED"
  nameof::nameof_enum(color) -> "RED"

  // Static storage enum variable to string.
  // This version is much lighter on the compile times and is not restricted to the enum_range limitation.
  NAMEOF_ENUM_CONST(Color::GREEN) -> "GREEN"
  nameof::nameof_enum<Color::GREEN>() -> "GREEN"

  // Enum flag variable to string.
  NAMEOF_ENUM_FLAG(Color::GREEN | Color::BLUE) -> "GREEN|BLUE"
  nameof::nameof_enum_flag<Color::GREEN>() -> "GREEN|BLUE"
  • Nameof type
  const my::detail::SomeClass<int>& var_ref = var;
  // Name of variable type.
  NAMEOF_TYPE_EXPR(var_ref) -> "my::detail::SomeClass<int>"
  nameof::nameof_type<decltype(var_ref)>() -> "my::detail::SomeClass<int>"
  NAMEOF_FULL_TYPE_EXPR(var_ref) -> "const my::detail::SomeClass<int>&"
  nameof::nameof_full_type<decltype(var_ref)>() -> "const my::detail::SomeClass<int>&"
  NAMEOF_SHORT_TYPE_EXPR(var_ref) -> "SomeClass"
  nameof::nameof_short_type<decltype(var_ref)>() -> "SomeClass"

  using T = const my::detail::SomeClass<int>&;
  // Name of type.
  NAMEOF_TYPE(T) ->"my::detail::SomeClass<int>"
  nameof::nameof_type<T>() -> "my::detail::SomeClass<int>"
  NAMEOF_FULL_TYPE(T) -> "const my::detail::SomeClass<int>&"
  nameof::nameof_full_type<T>() -> "const my::detail::SomeClass<int>&"
  NAMEOF_SHORT_TYPE(T) -> "SomeClass"
  nameof::nameof_short_type<T>() -> "SomeClass"

  my::detail::Base* ptr = new my::detail::Derived();
  // Name of type, using rtti.
  NAMEOF_TYPE_RTTI(*ptr) -> "my::detail::Derived"
  NAMEOF_FULL_TYPE_RTTI(*ptr) -> "volatile const my::detail::Derived&"
  NAMEOF_SHORT_TYPE_RTTI(*ptr) -> "Derived"
  • Compile-time
  constexpr auto somevar_name = NAMEOF(somevar);
  // somevar_name -> "somevar"
  constexpr auto color_name = NAMEOF_ENUM(Color::BLUE); // or nameof::nameof_enum(Color::BLUE)
  // color_name -> "BLUE"
  constexpr auto var_type_name = NAMEOF_TYPE_EXPR(var); // or nameof::nameof_type<decltype(var)>()
  // var_type_name -> "int"
  constexpr auto type_name = NAMEOF_TYPE(T); // or nameof::nameof_type<T>()
  // type_name -> "int"

Remarks

  • Before use, read the [limitations](doc/limitations.md) of functionality.

Integration

You should add required file [nameof.hpp](include/nameof.hpp).

If you are using vcpkg on your project for external dependencies, then you can use the nameof package.

If you are using Conan to manage your dependencies, merely add nameof/x.y.z to your conan's requires, where x.y.z is the release version you want to use.

Archlinux users can install nameof by package manager AUR, using the following command: yay -S nameof.

Alternatively, you can use something like CPM which is based on CMake's Fetch_Content module.

CPMAddPackage(
    NAME nameof
    GITHUB_REPOSITORY Neargye/nameof
    GIT_TAG x.y.z # Where `x.y.z` is the release version you want to use.
)

Compiler compatibility

  • Clang/LLVM >= 6
  • MSVC++ >= 14.11 / Visual Studio >= 2017
  • Xcode >= 10
  • GCC >= 7 (GCC >= 9 for NAMEOF_ENUM)

Licensed under the [MIT License](LICENSE)


*Note that all licence references and agreements mentioned in the Nameof C++ README section above are relevant to that project's source code only.

Do not miss the trending, libraries, news and articles with our weekly report.

Awesome C++ is part of the LibHunt network. Terms. Privacy Policy.

(CC)
BY-SA
Spin The Wheel Of Names for a cryptographically secure random name picker.
Schedule a when to meet poll.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.