DronPop / format

String interpolation. An example of using Parameter pack in C++.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

format

  • Introduction
  • Getting Started
    • Simple example using format
    • Basic Installation
  • Features
    • Advantages
    • Disadvantages

Introduction

This project is analogous to QString :: arg and other similar means of string interpolation. The key is the use of using C++ Parameter pack.

Getting Started

Simple example using format

std::string result = formated("int = %, double = %, std::string = %, const char * = %, bool = %",
                                     1,          3.14,            str,              "char*",  true);
//string = "int = 1, double = 3.140000, std::string = testString, const char * = char*, bool = 1".

Basic Installation

  1. git clone https://github.com/DronPop/format.git
  2. cd format/Example
  3. mkdir build
  4. cd build
  5. cmake .. -G "IDAName"
  6. open SolutionName

Features

Advantages

  • Strongly typed
  • Can be used with all standard types
  • Ability to use with custom types. For that overload operator<<(std::ostream& out_, const CustomClass& obj_);

Disadvantages

  • May be complile time.

About

String interpolation. An example of using Parameter pack in C++.

License:MIT License


Languages

Language:C++ 94.8%Language:CMake 5.2%