Utxcpp Library

Utxcpp Library
Login

UTXCPP

Utxcpp is an easy and simple to use c++ library that makes simple things be simple.

Utxcpp is cross-platform working on all modern c++ compatible (at least c++20) operating systems. The goal of utxcpp is to make frequently used common things be called simply and directly.

WARNING: This project is still in early development, will be very frequently changed currently, and has no stable release control, it is not recommended to use in production. The source code is released under the Boost Software License, you can find the files in the source.

Utxcpp Fossil

https://cppfx.xyz/fossil/utxcpp

Utxcpp Example

Mini Example

#include <utxcpp/core.hpp>

int main()
{
        utx::print("Hello", "Utxcpp", "!", 3.14159);
}

utx::print

#include <utxcpp/core.hpp>
#include <complex>
#include <numbers>

using namespace utx::numbers; // It "using namespace std::numbers;" too.

int main()
{
	utx::print("pi=", pi, '\n', "e=", e, "\n", "phi=", phi, '\n', "egamma=", egamma);
}

utxcpp thread

utxcpp thread is not another new thread implementation, but made on top of std::thread/std::future, to make it be simpler.
#include <utxcpp/core.hpp>
#include <utxcpp/thread.hpp>
#include <mutex>

std::mutex mutex;

template <class T>
auto fn = []
{
	for (int i=0; i<int('G'-'A'+1); ++i)
	{
		// sleep for 0.2 seconds
		utx::sleep(0.2);
		std::unique_lock<std::mutex> guard{mutex};
		utx::print("=>", (T)(i+'A'));
	}
};

int main()
{
	// deferred is deferred, async is async.
	auto f1 = utx::deferred(fn<int>);
	auto f2 = utx::async(fn<char>);
	f1.wait();
}

How to install utxcpp

1. Clone utxcpp code

fossil clone https://cppfx.xyz/fossil/utxcpp utxcpp.fossil

2. Build and install utxcpp

mkdir utxcpp
cd utxcpp
fossil open ../utxcpp.fossil
b2 config --prefix=/usr/local
b2
b2 install

More information, read README.md . Build for your os, read install/build-???.md .