Creating a Test Report document using Cpp
Hi everyone. I am relatively new at cpp, but I have a mini project I would like to complete if possible. I am a test lab intern at Dana inc. and was wondering if it is possible to automate the engineers test reports. My engineer mentor mentioned that it would be nice if this could be done. Currently, they use microsoft word and have a template already, but they would like an executable file where it prompts the user to input certain responses. After they submit all the responses, the program will generate the fully formatted report.
Any guidance on this would be appreciated! Thank you
https://redd.it/1e3ts7y
@r_cpp
[C++20] mp2.0 - Back to the Future Meta-Programming! (ranges, reflection / msvc, gcc, clang)
# Meta-Programming is one of the C++ super-powers!
Traditional meta-programming model in C++ is very powerful but not the easiest to grasp. Mainly because it has different syntax than normal C++ with a lot of angle brackets, it's functional, immutable, etc.
There are some great template meta-programming libraries available such as boost.mp11 - https://www.boost.org/doc/libs/1_85_0/libs/mp11/doc/html/mp11.html which make template meta-programming much simpler.
The question is - Can we do better? And if so, what are the trade-offs? All in all, wouldn't be great to be able to write the same code for run-time and compile-time and/or debug compile-time code at run-time?
Reflection for C++ - https://wg21.link/P2996 - introduced a new meta-programming model which is value/consteval based and can greatly improve the experience. Together with reflection is a very powerful combination but it also has its own set of trade-offs such as slower compilation-times.
This post is about `mp` - https://github.com/boost-ext/mp - meta-programming library which supports - similar to P2996 - meta-programming model for easier transition as it supports C++20 (msvc, gcc, clang), has a bit faster compilation times than P2996, but mostly, it makes meta-programming a 'normal' C++. There is also no difference between run-time and compile-time in the mp world, whole standard library can be leveraged and it has reflection integration with C++20 using https://github.com/boost-ext/reflect. Of course it has it own set of trade-offs but it has a lot of potential (IMHO).
> Example (API)
// mp::meta
static_assert(mp::meta<int> != mp::meta<void>);
static_assert(std::is_same_v<decltype(mp::meta<int>), decltype(mp::meta<void>)>);
// mp::type_of
constexpr mp::info meta = mp::meta<int>;
mp::type_of<meta> i{}; // same as int i{};
mp::type_of<mp::meta<bool>> b = true; // same as bool b = true;
// mp::apply
template<class...> struct type_list{ };
static_assert(std::is_same_v<type_list<int>, mp::apply_t<type_list, mp::array{meta}>>);
// mp::invoke
static_assert(not mp::invoke<std::is_const>(meta));
static_assert(std::is_same_v<const int, mp::type_of<mp::invoke<std::add_const>(meta)>>);
// hello world
template<auto N, class... Ts>
using at_c = mp::type_of<std::array{mp::meta<Ts>...}[N]>;
static_assert(std::is_same_v<int, at_c<0, int, bool, float>>);
static_assert(std::is_same_v<bool, at_c<1, int, bool, float>>);
static_assert(std::is_same_v<float, at_c<2, int, bool, float>>);
// ranges
template<class... Ts>
constexpr mp::vector ranges =
std::array{mp::meta<Ts>...}
| std::views::drop(1)
| std::views::reverse
| std::views::filter([](auto m) { return mp::invoke<std::is_integral>(m); })
| std::views::transform([](auto m) { return mp::invoke<std::add_const>(m); })
| std::views::take(2)
;
static_assert(std::is_same_v<
std::variant<const int, const short>,
mp::apply_t<std::variant, ranges<double, void, const short, int>>
>);
// reflection (requires https://github.com/boost-ext/reflect)
struct foo {
int a;
bool b;
float c;
};
foo f{.a = 42, .b = true, .c = 3.2f};
constexpr mp::vector v = reflexpr(f)
| std::views::filter([&](auto meta) { return member_name(meta, f) != "b"; })
;
static_assert(std::tuple{42, 3.2f} == unreflexpr<std::tuple, v>(f));
> Full example - standalone - https://godbolt.org/z/Mjcxedzzj
> Full example - reflection - https://godbolt.org/z/ds3KMGhqP
> Library - https://github.com/boost-ext/mp
> Supported compilers - https://godbolt.org/z/qarWdbK79
> Compilation times benchmark - https://boost-ext.github.io/mp
> Updates - https://x.com/krisjusiak/status/1812744501636505616
https://redd.it/1e3oucd
@r_cpp
Spaceship 13
Hi,
this program works fine with C++17 but does not compile with C++20 for GCC 11.2 and Clang trunk. MSVC 19.34 accepts this. It implements a recursive variant (allowing a vector of the variant as variant). The general case would also allow a std::map<string, Variant> in the base variant.
First of all, I am not sure if this construct is legal C++. If it is not, this explains the problem. If it is (or ought to be), there seems to be something strange going on with the <=> operator. For some reason the compilers seem to ignore any user defined < or <=> operators and still tries to synthesize the <=> operator, where it ultimativly fails. Some combinations will also trigger an internal compile error in MSVC.
Our best guess is, the concepts still try to figure out what the proper return value for the <=> operator would be on std::vector<Variant> and then detect the recursion where they bail out.
There is a way around this issue by having BaseVariant as a member in Variant but for more complex examples this means a lot of typing.
I wonder if anyone has any insight if this construction is legal and if so, if there is an easier way to make it compile or if it should compile as is.
https://redd.it/1e383f3
@r_cpp
C++20 modules with Clang-CL: which way forward?
This has been bothering me for a long time, and given the stalemates I've seen everywhere, I'd like to ask what the stakeholders in the community think. This is a surprisingly simple issue but affects a lot of people.
### Preamble
Clang-CL is a compiler [driver](https://stackoverflow.com/questions/32595607/difference-between-compiler-and-compiler-driver-in-llvm) for Clang/LLVM that [supports MSVC's `cl.exe` command-line options](https://clang.llvm.org/docs/UsersManual.html#clang-cl), on top of supporting Clang's own options.
It is *not* a different compiler to Clang; in fact, the `clang-cl.exe` and `clang.exe` binaries in the official LLVM releases are bit-identical with equal checksums. Only the file name is different. On Linux, you could rename `/usr/bin/clang` to `/usr/bin/clang-cl` (which incidentally might already be present, depending on the distro and package) and try to run `clang-cl main.cpp`, and suddenly you have a compiler that will *automatically* look for (and probably fail to find) the Windows SDK and the MSVC C/C++ headers and libraries, and will target `x86_64-pc-windows-msvc` (i.e. the MSVC C++ ABI) without explicitly having to specify anything^(†).
This behaviour may also be controlled in the command-line with `--driver-mode`. You can send normal Clang into Clang-CL mode with `--driver-mode=cl`. Similarly, you can force Clang to compile a file with a `.c` extension as C++ with `--driver-mode=g++` (and vice-versa, with `gcc`).
### The problem
`clang` has supported C++ modules in some form since Clang 15-16, which got a lot more stable in Clang 17, and I daresay is fully usable with Clang 18 (with some minor niggles). Given the above preamble, you'd expect `Clang-CL` to operate exactly the same way, which is not the case. The [Hello World](https://clang.llvm.org/docs/StandardCPlusPlusModules.html#quick-start) example for C++20 modules with Clang turns into the following with Clang-CL:
clang-cl.exe /std:c++20 .\Hello.cppm /clang:--precompile /Fo.\Hello.pcm
clang-cl.exe /std:c++20 use.cpp /clang:-fmodule-file=Hello=Hello.pcm .\Hello.pcm /Fo.\Hello.out
.\Hello.out
Hello World!
Okay, we need [`/clang:`](https://clang.llvm.org/docs/UsersManual.html#the-clang-option); big deal. This is alright when working off the command-line or in Makefiles (where the command-line invocation is manually specified anyway), but somehow the modern build systems—CMake and MSBuild; not entirely sure about Meson, Build2, and XMake—have collectively decided that 'Clang-CL does not support C++20 modules'.
I have opened/found the following threads/comments about the issue (the first is a *year* old, I can't believe it):
- https://discourse.llvm.org/t/clang-cl-exe-support-for-c-modules/72257
- https://gitlab.kitware.com/cmake/cmake/-/issues/25731
- https://www.reddit.com/r/cpp/comments/1b0zem7/what_is_the_state_of_modules_in_2024/ksbyp14/
- https://www.reddit.com/r/cpp/comments/18jvnoe/on_the_scalability_of_c_module_implementations_or/kdp5x6w/
- https://www.reddit.com/r/cpp/comments/1c6lbyn/cmake_330_will_experimentally_support_import_std/l02nx6s/
From what I see, discussion has stalled. There are a few options:
- Expect and allow Clang-CL to accept Clang's `-fmodule-*` and `--precompile` as first-class citizens, i.e. without `/clang:`.
- This is straightforward—a handful of one-liners which [I have just submitted](https://github.com/llvm/llvm-project/pull/98761).
- This means accepting that Clang-CL's module handling is different to CL's, and accounting for this in all build systems.
- Require Clang-CL (and therefore, Clang) to support MSVC's [`/ifc*`](https://devblogs.microsoft.com/cppblog/using-cpp-modules-in-msvc-from-the-command-line-part-1/) arguments, and therefore, imply that Clang emits MSVC-compatible IFCs.
- This requires some serious mangling that will probably involve all three of the driver, front-end, and back-end.
- However this is what many build system authors and users expect: for Clang-CL to behave exactly like CL.
Dual Build Mode: Header Includes or Module Imports
I am working on making a large legacy codebase "module ready". My plan is to use a CMake option (e.g., -D USE_MODULES=ON
) to switch from header includes to module imports. This should require minimal changes to the current .hpp/.cpp files, and I intend to create a thin wrapper module.
I found this reddit post by Daniela Engert where she explains how she transformed the header-only fmt library to support such a dual build mode. However, I've encountered challenges applying this approach to libraries with source files (i.e., not header-only).
I've created a working solution in this repository (particularly note the 06/
folder) and wrote a related blog post discussing the implementation.
Has anyone else attempted something similar or found a better solution? Links to dedicated blog posts, repositories, or YouTube talks would be much appreciated.
Additionally, I would welcome any general feedback. Are there any potential pitfalls I haven't addressed yet?
https://redd.it/1e37dd6
@r_cpp
QuickFunctions: Code Golf but for Performance
https://github.com/AidenSwayne/QuickFunctions
https://redd.it/1e33gfg
@r_cpp
Photoshop API - Read and Write PSD files with Python and C++
Hey,
Emil Dohne is creating a modern and performant C++20 read/write parser of Photoshop Files (\*.psd and \*.psb) with fully fledged Python bindings hosted on PyPi, completely on its own.
I just wanted to help him out trying to make his work known, so that more people can utilize this incredibily useful repo and in order to find someone incredibly talented and kind people that wanted to help him out collaborating in the development! At the moment Emil is occupied by another project that he will end by the end of July and he will then be back 100% on this project.
I reckon that the hierarchy of new features needed/really wanted are the following:
1. Support for Smart Object Layers - replacing images inside of the smart object
2. Support for Adjustment Layers
3. Support for Vector Masks
4. Support for Text Layers
5. CMYK, Indexed, Duotone and Greyscale Color Modes
**Thank you to whoever even takes the time to read this, let alone whoever shares this project and even more to incredibly smart people that will help Emil out.**
Here's some more info about this project: [https://github.com/EmilDohne/PhotoshopAPI](https://github.com/EmilDohne/PhotoshopAPI)
# About
**PhotoshopAPI** is a C++20 Library with Python bindings for reading and writing of Photoshop Files (\*.psd and \*.psb) based on previous works from [psd\_sdk](https://github.com/MolecularMatters/psd_sdk%3E), [pytoshop](https://github.com/mdboom/pytoshop) and [psd-tools](https://github.com/psd-tools/psd-tools%3E). As well as the official [Photoshop File Format Specification](https://web.archive.org/web/20231122064257/https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/), where applicable. The library is continuously tested for correctness in its core functionality. If you do find a bug please submit an issue to the github page.
The motivation to create another library despite all the other works present is that there isn't a library which has layer editing as a first class citizen while also supporting all bit-depths known to Photoshop (`8-bits`, `16-bits`, `32-bits`). This Library aims to create an abstraction between the raw binary file format and the structure that the user interfaces against to provide a more intuitive approach to the editing of Photoshop Files.
# Why should you care?
Photoshop itself is unfortunately often slow to read/write files and the built-in tools for automatically/programmatically modifying files suffer this same issue. On top of this, due to the extensive history of the Photoshop File Format, Photoshop files written out by Photoshop itself are often unnecessarily bloated to add backwards compatibility or cross-software compatibility.
The PhotoshopAPI tries to address these issue by allowing the user to read/write/modify Photoshop Files without ever having to enter Photoshop itself which additionally means, no license is required. It is roughly 5-10x faster in reads and 20x faster in writes than photoshop while producing files that are consistently 20-50% lower in size (see the benchmarks section on readthedocs for details). The cost of parsing is paid up front either on read or on write so modifying the layer structure itself is almost instantaneous (except for adding new layers).
# Features
Supported:
* Read and write of \*.psd and \*.psb files
* Creating and modifying simple and complex nested layer structures
* Pixel Masks
* Modifying layer attributes (name, blend mode etc.)
* Setting the Display ICC Profile
* Setting the DPI of the document
* 8-, 16- and 32-bit files
* RGB Color Mode
* All compression modes known to Photoshop
Planned:
* Support for Smart Object Layers
* Support for Adjustment Layers
* Support for Vector Masks
* Support for Text Layers
* CMYK, Indexed, Duotone and Greyscale Color Modes
Not Supported:
* Files written by the PhotoshopAPI do not contain a valid merged image in order to save size meaning they will not behave properly when opened in third party apps requiring these (such as Lightroom)
* Lab and Multichannel Color
Flecs v4, an Entity Component System for C and C++ is out!
https://ajmmertens.medium.com/flecs-v4-0-is-out-58e99e331888
https://redd.it/1e2sztw
@r_cpp
New Project Development Environment and Project Structure
For new C++ projects, what type of development environment tools and project structures do you typically consider?
This is a general question, so it can be anything from just a preferred IDE, or project file structure, all the way to more esoteric technologies and techniques.
I’m relatively inexperienced with C/C++, and the lion’s share of my experience is in C#, Python, and JS/TS/Angular, so I would also appreciate any learning material that you might suggest about c++ project structure and architecture (not so focused on language syntax or features)
https://redd.it/1e2jo9w
@r_cpp
Seeking Advice on Implementing Modern Logging in C++20 (for a Game Engine)
I'm working on a project for learning purposes, specifically a game engine. As part of this, I've been developing a logging component. After researching existing logging implementations (spdlog, Unreal Engine, O3DE, Abseil, gRPC, etc.), I noticed that many are outdated, apart from spdlog. Logging is typically one of the initial components implemented and often lacks newer features.
I'm currently using C++20 and want to understand how modern logging should be implemented. I've created two basic implementations for logging formatted output to the console:
Implementation 1: FormatLogger
#pragma once
#include <format>
#include <string_view>
class FormatLogger {
public:
template<typename... Args>
void log(std::string_view format, Args &&...args) {
auto formatted = std::vformat(format, std::make_format_args(args...));
output(formatted);
}
private:
void output(const std::string &message);
};
void FormatLogger::output(const std::string &message) {
std::cout << message << '\n';
}
#pragma once
class VAListLogger {
public:
void log(const char* format, ...);
private:
static constexpr size_t BUFFER_SIZE = 1024;
void output(const char* message);
};
#include <cstdarg>
#include <cstdio>
void VAListLogger::log(const char *format, ...) {
va_list args;
va_start(args, format);
char buffer[1024]; // Adjust size as needed
vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
output(buffer);
}
void VAListLogger::output(const char *message) {
printf("%s\n", message);
}
Just started coding about 2 days ago, no prior knowledge or anything. Thoughts about my first project?
// made by terens
#include <iostream>
#include <cmath>
void square();
int main() {
int op;
double n1, n2, res;
while (true) {
std::cout << "Calculator\\n\\n";
std::cout << "Choose an operation\\n";
std::cout << "1. Addition\\n2. Subtraction\\n3. Multiplication\\n4. Division\\n5. Square Root\\n6. Exit \\n-> ";
std::cin >> op;
if (op == 6) {
std::cout << "\\nCalculator exited." << std::endl;
return 0;
}
if (op < 1 || op > 6) {
std::cout << "Invalid operation.\\n\\n";
continue;
}
if (op == 5) {
square();
continue;
}
std::cout << "Enter the first number: \\n-> ";
std::cin >> n1;
if (op != 5) {
std::cout << "Enter the second number: \\n-> ";
std::cin >> n2;
}
switch (op) {
case 1:
res = n1 + n2;
break;
case 2:
res = n1 - n2;
break;
case 3:
res = n1 * n2;
break;
case 4:
if (n2 == 0) {
std::cout << "Error. Cannot divide by zero.\\n\\n";
continue;
}
res = n1 / n2;
break;
default:
std::cout << "Invalid operation.\\n\\n";
continue;
}
std::cout << "The result is: " << res << "\\n\\n";
}
}
void square() {
double num, result;
std::cout << "\\nEnter number: -> ";
std::cin >> num;
result = sqrt(num);
std::cout << "\\nThe result is: " << result << "\\n\\n";
}
https://redd.it/1e2cda3
@r_cpp
Small console style text based rpg game engine
Essentially I’ve just started to learn code I tried to learn python a while ago and know maybe like 2 functions and how to make functions but not enough to properly build a function without chat gpt or someone’s help, now I recently starting learning or trying to learn c++ and I’ve learned about as much about c++ as I did python which was like 2% and I had chat gpt teach me what I know after going back and fourth of the last 48 hours on and off to make an engine I have it running but it’s missing a lot features and need help finishing it maybe a codepen could work where if you seeing would be interested in teaching me c++ and how to make my little engine better could collaborate, thank you for your time reading
https://redd.it/1e1ywxv
@r_cpp
Summing ASCII encoded integers on Haswell at almost the speed of memcpy
http://blog.mattstuchlik.com/2024/07/12/summing-integers-fast.html
https://redd.it/1e1m1az
@r_cpp
C++ Coroutines at Scale - Implementation Choices at Google - Aaron Jacobs - C++Now 2024
https://www.youtube.com/watch?v=k-A12dpMYHo
https://redd.it/1e1ainv
@r_cpp
22 Common Filesystem Tasks in C++20
https://www.cppstories.com/2024/common-filesystem-cpp20/
https://redd.it/1e3pm0y
@r_cpp
Crow Cpp
Hey everyone I am trying to setup a simple web server and am having a bit of problems getting Crow setup. My issue is after I pull the repo and try to make my own main.cpp and compile it the crow.h seems to be having problems seeing the other header files no matter how I move them.
https://redd.it/1e3lgba
@r_cpp
Personally, I feel there is existing precedent for Clang-CL's behaviour to diverge from CL's, which honestly should be expected: *they're different compilers*, after all. For instance, link-time/whole-program/inter-procedural optimisation is handled in Clang-CL using `-flto=thin`. It doesn't even *have* MSVC's `/GL` and `/LTCG`. The interim object binaries emitted are incompatible, too.
I'm inclined to believe C++ modules are a very similar situation, especially given all implementations rely deeply on compiler internals. In fact one can't even mix `.pcm` files compiled by Clangs with different Git commit hashes.
I'd love to spur some discussion about this, which I daresay is one of the last few BIG issues with C++20 modules. Clang and MSVC devs, build system authors, and users, do say what you think.
___
† Fun fact, this setup *completely* obviates and is probably superior to MinGW as a Windows cross-compiler for Linux, especially if you go the full bore and mount the real MSVC headers, libraries, and Windows SDK in a case-insensitive filesystem like [the Firefox guys have done](https://glandium.org/blog/?p=4020).
https://redd.it/1e36n0w
@r_cpp
C++20 modules with Clang-CL: which way forward?
This has been bothering me for a long time, and given the stalemates I've seen everywhere, I'd like to ask what the stakeholders in the community think. This is a surprisingly simple issue but affects a lot of people.
### Preamble
Clang-CL is a compiler driver for Clang/LLVM that supports MSVC's `cl.exe` command-line options, on top of supporting Clang's own options.
It is not a different compiler to Clang; in fact, the clang-cl.exe
and clang.exe
binaries in the official LLVM releases are bit-identical with equal checksums. Only the file name is different. On Linux, you could rename /usr/bin/clang
to /usr/bin/clang-cl
(which incidentally might already be present, depending on the distro and package) and try to run clang-cl main.cpp
, and suddenly you have a compiler that will automatically look for (and probably fail to find) the Windows SDK and the MSVC C/C++ headers and libraries, and will target x86_64-pc-windows-msvc
(i.e. the MSVC C++ ABI) without explicitly having to specify anything^(†).
This behaviour may also be controlled in the command-line with --driver-mode
. You can send normal Clang into Clang-CL mode with --driver-mode=cl
. Similarly, you can force Clang to compile a file with a .c
extension as C++ with --driver-mode=g++
(and vice-versa, with gcc
).
### The problemclang
has supported C++ modules in some form since Clang 15-16, which got a lot more stable in Clang 17, and I daresay is fully usable with Clang 18 (with some minor niggles). Given the above preamble, you'd expect Clang-CL
to operate exactly the same way, which is not the case. The Hello World example for C++20 modules with Clang turns into the following with Clang-CL:
clang-cl.exe /std:c++20 .\Hello.cppm /clang:--precompile /Fo.\Hello.pcm
clang-cl.exe /std:c++20 use.cpp /clang:-fmodule-file=Hello=Hello.pcm .\Hello.pcm /Fo.\Hello.out
.\Hello.out
Hello World!
Okay, we need `/clang:`; big deal. This is alright when working off the command-line or in Makefiles (where the command-line invocation is manually specified anyway), but somehow the modern build systems—CMake and MSBuild; not entirely sure about Meson, Build2, and XMake—have collectively decided that 'Clang-CL does not support C++20 modules'.
I have opened/found the following threads/comments about the issue (the first is a year old, I can't believe it):
- https://discourse.llvm.org/t/clang-cl-exe-support-for-c-modules/72257
- https://gitlab.kitware.com/cmake/cmake/-/issues/25731
- https://www.reddit.com/r/cpp/comments/1b0zem7/whatisthestateofmodulesin2024/ksbyp14/
- https://www.reddit.com/r/cpp/comments/18jvnoe/onthescalabilityofcmoduleimplementationsor/kdp5x6w/
- https://www.reddit.com/r/cpp/comments/1c6lbyn/cmake330willexperimentallysupportimportstd/l02nx6s/
From what I see, discussion has stalled. There are a few options:
- Expect and allow Clang-CL to accept Clang's -fmodule-*
and --precompile
as first-class citizens, i.e. without /clang:
.
- This is straightforward—a handful of one-liners which I have just submitted.
- This means accepting that Clang-CL's module handling is different to CL's, and accounting for this in all build systems.
- Require Clang-CL (and therefore, Clang) to support MSVC's `/ifc*` arguments, and therefore, imply that Clang emits MSVC-compatible IFCs.
- This requires some serious mangling that will probably involve all three of the driver, front-end, and back-end.
- However this is what many build system authors and users expect: for Clang-CL to behave exactly like CL.
Difference between initializer lists?
I'm reading Jason Turner's Best Practices (https://leanpub.com/cppbestpractices) (no affiliation, just enjoy his content).
Anyways, from one of the chapters, he asks the reader to explain the difference between the following as an exercise:
std::array<std::sharedptr<char>, 2> data {
std::makeshared<char>(40), std::makeshared<char>(2)
};
std::vector<std::sharedptr<char>> vec {
std::makeshared<char>(40), std::makeshared<char>(2)
};
(Specifically, I believe he means the difference with respect to how the initializer list works // allocations).
I ran these examples on compiler explorer while overloading the `new` operator, and the results are interesting (see link below) - `vec` has an extra 32 byte allocation. Anyone understand where that comes from...?
https://godbolt.org/z/e6GYcafh9
https://redd.it/1e35xjo
@r_cpp
Modes
# Python
The PhotoshopAPI comes with fully fledged Python bindings which can be simply installed using
$ py -m pip install PhotoshopAPI
alternatively the wheels can be downloaded from the Releases page. For examples on how to use the python bindings please refer to the Python Bindings section on [Readthedocs](https://photoshopapi.readthedocs.io/en/latest/index.html) or check out the PhotoshopExamples/ directory on the github page which includes examples for Python as well as C++.
For an even quicker way of getting started check out the [Quickstart](https://github.com/EmilDohne/PhotoshopAPI#quickstart) section!
# Documentation
The full documentation with benchmarks, build instructions and code reference is hosted on the [PhotoshopAPI readthedocs page](https://photoshopapi.readthedocs.io/).
# Requirements
This goes over requirements for usage, for development requirements please visit the [docs](https://photoshopapi.readthedocs.io/).
* A CPU with AVX2 support (this is most CPUs after 2014) will greatly increase performance, if we detect this to not be there we disable this optimization
* A 64-bit system
* C++ Library: **Linux**, **Windows** or **MacOS**
* Python Library^(1): **Linux**, **Windows**, **MacOS**
The python bindings support python >=3.7 (except for ARM-based MacOS machines which raise this to >=3.10)
>
# Performance
The PhotoshopAPI is built with performance as one of its foremost concerns. Using it should enable you to optimize your pipeline rather than slow it down. It runs fully multithreaded with SIMD instructions to leverage all the computing power your computer can afford.
As the feature set increases this will keep being one of the key requirements. For detailed benchmarks running on a variety of different configurations please visit the [docs](https://photoshopapi.readthedocs.io/)
Below you can find some of the benchmarks comparing the PhotoshopAPI ('PSAPI') against Photoshop in read/write performance
https://redd.it/1e337j8
@r_cpp
Speaking of intuitive and hard-to-misuse APIs...
Is it just me or is this extremely counter-intuitive? (taken from here)// std::greater<int> makes the max priority queue act as a min priority queue.
It's been years and I still haven't found an easy way to memorise which comparator turns a sort into an ascending and which turns it into a descending order, and this isn't making it any easier. Does anyone have a trick that makes it easier for you?
https://redd.it/1e2yamz
@r_cpp
Need c++ development resources
I know c++ applicable to algorithmic problems and icpc style competitions (Generally revolves around standard template library and the other classic beginner stuff till OOPs)
I want to contribute to c++ projects but I realized that they use a very different style of c++ involving lots of files and call from this file to that file and what not
Looking for some resources to learn "this" kind of c++ preferrably some article or book but video tutorials are also welcome
https://redd.it/1e2lhn6
@r_cpp
C++ really needs static_print/static_warn functionality
Seriously, why is this not a thing when static_assert already exists?
https://redd.it/1e2fmcw
@r_cpp
The most complicated constructor set in STL.
https://en.cppreference.com/w/cpp/utility/expected/expected
https://redd.it/1e2e6jx
@r_cpp
IDE for competitive programming
I'm using vs code currently(begineer) and there are a lot of bugs then i tried switching and i downloaded sublime text but i don't know why it isn"t creating new bulid system. I watched almost all videos in youtube and there's no solution for it. what do I do now??
https://redd.it/1e2927s
@r_cpp
Trip Report: Summer ISO C++ Meeting in St. Louis, USA | think-cell
https://www.think-cell.com/en/career/devblog/trip-report-summer-iso-cpp-meeting-in-st-louis-usa
https://redd.it/1e1zpfq
@r_cpp
Declaring an int main() function in a header
Hello,
I wonder is that make any sense to declare a default C++ function in, let say `main.h` file accompanying `main.cpp` file? I do it for any other custom function/method obviously. It seems that for Apple clang 15.0.0 it does not matter if it is declared or not as long as it's defined using C++20 Standard. May it be a good practice to include it make a code more readable for others or maybe it is even required for some deep C++ Standard?
Thanks in advance.
https://redd.it/1e1l62d
@r_cpp
Trip report: C++ On Sea 2024
https://www.sandordargo.com/blog/2024/07/10/cpponsea2024-trip-report
https://redd.it/1e1a8xi
@r_cpp
Boost Library 4.8.5 with GCC 8.3?
Between the two compilers (4.8.5 ->8.3), the results.hpp depends on variant. As a result, between these includes ~ line 96 of system/result.hpp, the 8.3 compiler throws an error about an incomplete class definition. However, this is not the issue in 4.8.5. Using boost 1.81. Got the same issue using 1.56/59
I dont have an option to currently install and build a 8.3 version of boost to support backwards compatibility, but instead focused on replacing code depending on boost pointers, threads, and logging with those in the stdlib.
My question is, why is the differing compilers suddenly cause this particular class definition to fail? To resolve this, Im planning going back and using a directive:
\#if cplusplus == 11 (not accurate but point)
include <stddep>
typedef std::whatever someName
\#else
<boost/dep>
typedef boost::whatever someName
~ Code with someName ~
This way, it should remain available to c++98 std and port to our upgrade in progress to the c++11 std. Am I going about this right? We plan to remove the library altogether when we confirm its replaceable by stdlib, minus a few tools we build from it. But im just interested in an explanation on what may have changed to cause the failure.
Sorry for formatting, Im on mobile.
https://redd.it/1e16sr5
@r_cpp