Skip to content

An easier and prettier way to print content, including containers, in C++

License

Notifications You must be signed in to change notification settings

illescasDaniel/print.hpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

print.hpp

Build Status Version license

With the 'evt::print()' function you can display information easily.
The 'to_string' function let you convert ANY data container (like std::vector) to string.

Syntax examples

· print:

print(const Type& value, const Args& ...args);

· Example:

print("This is a number:", 23123); // Output -> This is a number: 23123



· to_string for containers like std::vector, std::array, etc:

to_string(const container& cont); 

· Example using both functions:

print("My vector:", to_string(vector)); // Possible output -> My vector: [1, 2, 3]

// or:
print("My vector:", vector);



· to_string for classic arrays:

to_string(const T * array, size_t size);

· Example:

print(to_string(array, 5));



· to_string for matrices:

to_string(const Type& matrix, size_t rows, size_t cols);

· Example:

print(to_string(matrix, rows, cols)); // An output -> [[1, 2], [3, 4], [5, 6]]



How to compile:

g++ -std=c++14 main.cpp -I . // Where "." is the folder containing "print.hpp"

About

An easier and prettier way to print content, including containers, in C++

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published