Skip to content

Repository files navigation

cpp_fstring_examples

Examples of using a C++ preprocessing script cpp-fstring to process python-style f-strings.

This companion repository shows how to incorporate cpp-format in a cmake environment, and has examples of using C++ f-strings.

Credits/Motivation

See cpp-fstring

Getting Started

├── Makefile
├── include
│ └── fstr.h
├── examples
│ ├── CMakeLists.txt
│ ├── psrc
│ │ ├── demo_misc.cpp
│ │ ├── ...
│ │ ├── enum_namespace.cpp
│ │ ├── fixed_size_string_buffer.h
│ │ └── tinyply.h
│ ├── src
│ │ ├── demo_misc.cpp
│ │ ├── ...
│ │ ├── enum_namespace.cpp
│ │ ├── fixed_size_string_buffer.h
│ │ └── tinyply.h
│ ├── out
│ │ ├── demo_misc.log
│ │ ├── ...
│ │ └── enum_namespace.log

Look at the Makefile for debug or release targets. The cmake command generates run files under build dir and then uses cpp-fstring to convert files under psrc dir to src dir. This generated code is compiled and executed. in examples/CMakeLists.txt the following cmake command adds the cpp-fstring step:

COMMAND cpp-fstring ${source} -I src -I ../include >${target}

for a single file like examples/psrc/class_basic.cpp this is equvalent to:

cpp-fstring examples/psrc/class_basic.cpp -I src -I ../include > examples/src/class_basic.cpp

API

Tests and Benchmark

Using cpp_fstring

Dir Structure

Authors

License

The project is available under the MIT license. See LICENSE file for details

About

Examples of using cpp-fstring: python style f-strings in C++

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages