Utxcpp Library

Utxcpp Library
Login

UTXCPP

Utxcpp is turbine freebsd hobbist swimmers' 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.

Utxcpp Fossil Source

https://cppfx.xyz/fossil/utxcpp

Utxcpp Example

Mini Example (C++ Includes)

#include <utxcpp/core.hpp>
int main() {
        print("Hello", "Utxcpp", "!", 3.14159);
}

Mini Example (C++ Modules)

import utxcpp;
int main() {
        print("Hello", "Utxcpp", "!", 3.14159);
}

utx::print

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

using namespace std::numbers;

// "using namespace std::literals" is already opened by utxcpp.

constexpr std::complex im = 1.0i;

int main() {
	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};
		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 .

Donate

Donate to me for these projects: cppfx.xyz, utxcpp, pest, some development for BSD and cross-platform wares.

Monero:

49nVvBTqquMUsQ76KrTZQbdSSwG6oXEu2XdMFV9D6ZMQKNrYyP66h6M8PvrTgZXfcKBDNPLZNpZhBgWb1eJffZxYH34BUd3

Ravencoin:

R9d24w4AsDmGacKe9RbpzZ7923BDfswbPv