/robowaifu/ - DIY Robot Wives

Advancing robotics to a point where anime catgrill meidos in tiny miniskirts are a reality

Porn boards have been deleted. Orphaned files will be cleared in 3 days, download images if you have hotlinks.


Days left: 34


JulayWorld fallback document - SAVE LOCALLY

JulayWorld onion service: bhlnasxdkbaoxf4gtpbhavref7l2j3bwooes77hqcacxztkindztzrad.onion

Max message length: 32768

Drag files to upload or
click here to select them

Maximum 5 files / Maximum size: 20.00 MB

More

(used to delete files and postings)


C++ General Robowaifu Technician 09/09/2019 (Mon) 02:49:55 No.12
C++ Resources general

The C++ programming language is currently the primary AI-engine language in use.

isocpp.org/get-started
https://archive.is/hp4JR

stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
https://archive.is/OHw9L

en.cppreference.com/w/
https://archive.is/gt73H

www.youtube.com/user/CppCon
https://archive.is/QGynC

BTW if you're new to C++ and you're stuck on Windows (either you can't or won't upgrade to Linux) then you can at least incorporate a good, open shell into your system to begin with so you can follow along. Start at this link, and if you have any questions just ask ITT:
www.msys2.org/
https://archive.fo/p3EUc
Edited last time by Chobitsu on 10/05/2019 (Sat) 20:16:32.
BTW, for anons who are interested in learning C++ but don't know where to start this book is literally the best (serious) beginner programming book in existence IMO. And it just so happens to use C++ as the basis to teach the art of programming. It has my highest recommendation for anyone new to programming.

http : //www.stroustrup.com/Programming/
Edited last time by Chobitsu on 09/11/2019 (Wed) 07:57:58.
I discovered this book a few months ago and bought a copy. I've been progressing through it as time allows. I'm now pretty much convinced that the new Ranges features coming up in C++20 will make programming functional in C++ both elegant and easy. Sample chapter:
https://livebook.manning.com/book/functional-programming-in-c-plus-plus/chapter-1/

A couple of reasons why functional is going to be important to us here on /robowaifu/ is that
1. The data structures are immutable (and basically optimized). This has huge implications for both run-time perf, and avoids metric shittons of potential complications for things like multithreading.
2. Composability. Functional approaches allow you to easily take a Generative or Metaprogramming approach to software development. Namely, you can pass an entire program into another program as an argument, and get an entirely new thing never seen before out the other end.

These things were always doable in C++ ofc, but the new features in C++20 will make the syntax clean, simple & elegant.
>>149
>and avoids metric shittons of potential complications for things like multithreading and security*
ftfm.

Looks like Manning made ch7 available too.
https://livebook.manning.com/book/functional-programming-in-c-plus-plus/chapter-7/
Open file (9.02 MB 1920x1080 stroustrup_engine.webm)
Quick drop-in from Morgan Stanley where the C++ language creator Bjarne Stroustrup shills the language.
via isocpp.org
Open file (148.31 KB 683x700 loliusingcomputer.jpg)
>>192
Do you dislike C++? If so, what are the problems you have with it?

>//-------------
SFW board, keep it spoilered anon.
Edited last time by Chobitsu on 09/13/2019 (Fri) 10:55:52.
>>193
No not really. It's a remarkable language, actually. It's biggest problem is that big. I mean yuge. That makes the learning curve to get to where you can do big projects with it pretty steep. There are a lot of easier languages to learn.
>>194
Right. I see. You basically have to be a master at it to use it properly. Do you feel that learning C++ is not worth the time?
>>195
Guess it depends on what you want to do actually. If you want to create a fancy webpage then JavaScript would be better and something like Python would be better for a webscraper or some kind of utility program like that. On the other hand from what this board seems like it's trying to do maybe C++ is just right who knows. I know it's going to be a lot of very hard work though, for sure.
>>196
Would programming a /robowaifu/ be best done using C++?
>>197
Maybe so.
There are two primary sources online, the actual standard itself, and cppreference .

While the C++ Committee isn't part of the ISO, like all other groups dealing with them they must literally give all their hard work over to these kikes if they want it to be adopted as an official international standard. So, the published standard itself is controlled by (((ISO))) and they want your sheqels. Lots of them (CHF198 for one pdf file!). Fucking jews man.

However, the C++ Foundation also actively maintains the draft of the standard (aka the 'working paper'), and that information is freely available via their site:
isocpp.org/std/the-standard
If you're autistic enough you can even compile your own pdf from the up-to-the-minute Latex sources:
github.com/cplusplus/draft

If you're not quite that /lit/, you can just use the online version maintained by one of the Committee members:
eel.is/c++draft/
Finally, you can also download his pdf version of the full draft standard as well:
github.com/timsong-cpp/cppwp

The above standard is, ofc, the final word in what is or isn't C++ .

But imo at least as important as the standard itself is the site cppreference.com . It addresses every feature of the language past and present--and even future. It's written by professionals (many of whom are on the Committee itself), for professionals. It's literally indispensable for a working C++ developer:

en.cppreference.com/w/
BTW, it's also the single best reference to the C language that's out there as well.

>tl;dr
The standard itself and cppreference are the only goto places for the C++ language definition, accept no substitutes.
Edited last time by Chobitsu on 09/14/2019 (Sat) 00:23:33.
>>214
>github.com/timsong-cpp/cppwp
I'm autistic enough that I didn't just want to post the latest draft right here, b/c it will quickly go out of date as the work progresses. I wanted anons to be able to find the authority itself.

But here's the latest from a little over a month ago atm.
>file related
For the anons learning C++ right now, here's a little utility I just wrote so I thought I would post it here so you could have a look at some simple C++ code and ask me anything about it.

So, I wanted to be able to get a listing of all thread subjects on the board, ranked by reply count and then by image count. C++ has a perfect container type for databases of this sort, the multimap:
en.cppreference.com/w/cpp/container/multimap

I simply clean up the raw input file a little, then go through and save out the reply counts and image counts and thread subjects. Multimap automatically keeps everything sorted by the key ([reply_count, image_count] in this case), and then I just dump that container out in order into a new file.

Here's the code, study it and ask questions.
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

// Returns true if all 3 tags are found inside the input line.
// ex. statline: R: 5 / I: 2 / P: 1 [R] [G] [-]
bool is_stat_line(const std::string& line)
{
bool p{false}, r{false}, i{false};
const std::vector<std::string> tags{"P:", "R:", "I:"};

for (const auto& e : tags) {
auto find_tag_it = line.find(e);
if (find_tag_it != std::string::npos) { // we have a tag

if (e == tags[0]) // page position
p = true;
if (e == tags[1]) // reply count
r = true;
if (e == tags[2]) // image count
i = true;
}
}

return (p && r && i);
}

// This function assumes we already have a verified valid statline via
// is_stat_line()
void load_rep_img(const std::string& stat_line,
std::pair<std::size_t, std::size_t>& rep_img)
{
// load a vector with the individual elements from the stat_line
std::stringstream ss{stat_line};
std::vector<std::string> elems{};
//
std::string elem{};
while (ss >> elem)
elems.emplace_back(elem);

// load the std::pair with stat values pulled from the vector
bool have_r{false}, have_i{false};
for (const auto& e : elems) {
// if the flag is already set, then this next element will be the data value
if (have_r) {
rep_img.first = std::stoull(e);
have_r = false;
}
else if (have_i) {
rep_img.second = std::stoull(e);
have_i = false;
}

// set the flags as needed
if (e == "R:")
have_r = true;
//
if (e == "I:")
have_i = true;
}
}

std::vector<std::string> load_lines(std::fstream& ifs)
{
std::vector<std::string> lines{};
std::string line{};

// Store all non-blank lines in the order they come (compact the file)
while (std::getline(ifs, line))
if (!line.empty())
lines.emplace_back(line);

return lines;
}

// Clean the raw input textfile copypasted out from the board catalog via a
// browser. Ignore extraneous information, while saving out a list of thread
// subjects, ranked by post count, then by image count, ascending order.
int main()
{
// file in
const std::string infile{"catalog_raw"};
std::fstream ifs(infile, ifs.in);
if (!ifs.is_open()) {
std::cerr << "failed to open input\n";
return -1;
}
// Store only non-blank lines from the input file
const std::vector<std::string> lines{load_lines(ifs)};

// The target final container for writing file output from
std::multimap<std::pair<std::size_t, std::size_t>, std::string> thread_map{};

// Determine if a line is the statistics line for a thread. If it is, grab the
// stats, then the NEXT line will be the thread subject line to store in the
// multimap target.
bool stat_found{false};
std::pair<std::size_t, std::size_t> rep_img{};
//
for (const auto& e : lines) {

if (stat_found) { // we have the thread's subject line presently
// (during the subsequent iteration _after_ statline)
// rep_img already loaded during the previous iteration.
thread_map.emplace(rep_img, e);
stat_found = false;
continue;
}

stat_found = is_stat_line(e);

if (stat_found) // retain the stats for the next iteration
load_rep_img(e, rep_img);
}

// file out
const std::string outfile{"catalog_ranked"};
std::fstream ofs(outfile, ofs.out);
//
for (const auto& e : thread_map)
ofs << "[" << e.first.first << "] [" << e.first.second << "]"
<< " " << e.second << '\n';
}

// TODO: Replace my clumsy hackery with a std::find_if() + lambda, and a
// std::transform(). When C++20 is out, convert the entire caller to
// functional code using the Ranges library.
Edited last time by Chobitsu on 09/20/2019 (Fri) 08:07:49.
>>521
To use this code yourself on a board to get it's ranked thread subject list, follow these steps:

1. Get set up to compile C++ code ofc, since this is C++ code. The isocpp.org/get-started link ITT can help you if you've never done that before.
2. Open the catalog page of a board and ctrl+a, then ctrl+c to copy all it's text to the system clipboard.
3. Open a plaintext editor, create a new file, then ctrl-v to paste the clipboard contents into that file.
4. Save the file to some directory where you can also save the file from the next step. Name it catalog_raw, no extensions. The code expects to find this exact name.
5. Select all the code from the above post following the same copy+paste+save idiom, and create a file named rank_catalog.cpp. Be sure to copy every single character.
6. Open the directory where you've saved these two files inside a terminal (command prompt) and enter this command:
g++ rank_catalog.cpp -o rank_catalog -std=c++11
This will create an executable file named rank_catalog (on Wangblows it will be rank_catalog.exe).
7. Execute the program.
./rank_catalog
A new textfile will be generated for you named catalog_ranked. Voilà, you now have a ranked copy of the board's threads. Repeat as desired for other catalogs (you don't have to go through the compiling process again, just save the catalog_raw file out again with the new data, then re-execute the program).

NOTE: This code will output the thread comment for a thread with no subject. It's a simple utility for my own purposes, and I didn't need to handle that corner case.
>>526
Heh, I just discovered this doesn't work properly on Wangblows, b/c it's a shitty OS that doesn't use line-endings properly like any decent OS would. I'll leave it to you filthy NSA_Botnet-OS™ users to find the fix haha. (there is a simple one) protip: save the raw_catalog textfile out differently, you mong
Edited last time by Chobitsu on 09/20/2019 (Fri) 07:05:47.
Also, one other point. Some imageboards don't have all three of the "R:", "I:", and "P:" fields in the catalog list (as used here on julay and was the case with 8ch). This code will fail if they are not all three present. If this is the case for a board you'd like to get the ranked list from, then modify the bool is_stat_line(const std::string&) function to match your needs, recompile & re-execute.

// Returns true if all 3 tags are found inside the input line.
// ex. statline: R: 5 / I: 2 / P: 1 [R] [G] [-]
bool is_stat_line(const std::string& line)
{
bool p{false}, r{false}, i{false};
const std::vector<std::string> tags{"P:", "R:", "I:"};

for (const auto& e : tags) {
auto find_tag_it = line.find(e);
if (find_tag_it != std::string::npos) { // we have a tag

if (e == tags[0]) // page position
p = true;
if (e == tags[1]) // reply count
r = true;
if (e == tags[2]) // image count
i = true;
}
}

return (p && r && i); // <== start here, anon! :^)
}
Open file (163.11 KB 1083x913 juCi++_027.png)
Q: What C++ editor/IDE do you recommend, Anon?
A: I use juCi++ on the Debian derivative, Ubuntu. Big project management I just do inside the terminal, with tmux+Vim as my goto there.

gitlab.com/cppit/jucipp

git clone --recursive https://gitlab.com/cppit/jucipp
mkdir jucipp/build
cd jucipp/build
cmake -DCMAKE_CXX_COMPILER=g++ ..
make
sudo make install
StackOverflow is, in general, also the best resource for finding C++ questions that have already been asked by someone before.
stackoverflow.com/questions/tagged/c%2b%2b

Also, the CPP subreddit.
reddit.com/r/cpp/
I know, I know
:^)

Various members of the ISO C++ Standards Committee actively participate in both these places.

>>559
Also, here's one article on the (only vaguely related) topic of GUI systems.
insights.dice.com/2016/11/18/5-cross-platform-guis-for-c/
https://archive.is/dKD4f
If you are already up and going writing good C++ programs, you should probably take a look at Runtime-Compiled C++. This will could be highly useful for more or less interactively developing robowaifu software.
runtimecompiledcplusplus.blogspot.com/
https://archive.is/aJytC

Set it up on your box:
Prereqs: (on my Debian deriv, see 'Getting-started-with-Runtime-Compiled-C-Plus-Plus.md' on the github's wiki for more details):
sudo aptitude install libfreetype6-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev libglfw-dev

Clone and build:
git clone https://github.com/RuntimeCompiledCPlusPlus/RuntimeCompiledCPlusPlus.git
cd RuntimeCompiledCPlusPlus/Aurora
mkdir build && cd build && cmake .. && make


Now, you should be able to successfully play with the SimpleTest demo in the Examples directory. See the 'Demo-Tutorials.md' on the code wiki for more details.

>pics related. before, during, and after making a minor code change on the fly with the included demo game under RCCpp's example dir.
>>562
RCCpp's Vimeo:
vimeo.com/runtimecompiledcplusplus/videos
https://archive.is/3X8PA
CppCon 2017
www.youtube.com/playlist?list=PLHTh1InhhwT6bwIpRk0ZbCA0N2p1taxd6
Open file (18.15 KB 480x360 0.jpg)
CppCon 2018
www.youtube.com/playlist?list=PLHTh1InhhwT6V9RVdFRoCG_Pm5udDxG1c
Can you get a job writing C++? I just started learning to code because I need a job and it's all confusing.
>>573
You can indeed. Glassdoor has over 12,000 current openings for senior C++ devs.
https://www.glassdoor.com/Job/jobs.htm?suggestCount=0&suggestChosen=false&clickSource=searchBtn&typedKeyword=senior+software+engineer+c%2B%2B&sc.keyword=senior+software+engineer+c%2B%2B&locT=&locId=&jobType=

>I just started learning to code because I need a job
Unfortunately, C++ takes a long time to master b/c it's yuge. It has many qualities that make it great for designing and developing robowaifu systems, but "I'm going to quickly get a great job doing this shit!" isn't one of them.

You'd probably be better off going for some kind of web-stack developer if you're committed to a software career and you need income from that as quickly as possible anon.
Open file (50.08 KB 638x791 (you).jpg)
>>574
Thanks heaps for the rundown, I'll work on webshit first.
>>578
nprb anon, good luck!
BTW, if you are here and you're very math-inclined, there is an excellent book on programming called Elements of Programming. This year (2019) the Addison-Wesley publishers declined keeping it in print and reverted the rights back to the authors. They have made it freely available online, and also sell a paperback version now.
http://elementsofprogramming.com/
by Stepanov & McJones
It is one of the best books on programming in existence, period. It's up there with Knuth's TAOCP tomes in terms of its rigor, but it's much, much smaller and far more approachable, imo.
The book uses C++ to discuss the mathematical and logical basis of programming, in the manner of Euclid's The Elements treatise.
>>648
I feel like TAOCP is more like a bible or an encyclopedia you can search the information you need in. Or maybe I haven't read enough of it to appreciate the overall structure and internal logics of it.
Open file (391.27 KB 1000x742 TAOCP-box.png)
>>649
that's probably a reasonable way to think about it anon. certainly the thousands and thousands of pages of the complete set (thus far) isn't just light reading heh.
I just discovered they have a C++ section. They've been pretty helpful to me in the past learning HTML & Python, so maybe this is helpful for someone too.
www.w3schools.com/cpp/default.asp
Open file (115.84 KB 1064x881 juCi++_001.png)
Open file (81.23 KB 1064x881 juCi++_003.png)
Open file (123.73 KB 1072x891 Selection_002.png)
Well I finally took the plunge the other day and had a go at picking up Meson basics. I had been using CMake pretty consistently for a few years.

I must say that not only is it very straight forward to pick up and use Meson, but the Ninja build system is excellent. It's fast, and it's smart about managing big builds.

Eventually we'll have multi-million line codebases in our robowaifus. Having a build system like Ninja, and Meson's concise multi-language project management capabilities are convincing me already this is the way to go.

>pics related
Bjarne uses FLTK as a GUI framework for teaching in PPP2, but it can be a challenge to get it working correctly in a generalized way w/o resorting to FLTK's own build scripts. By using Meson, I was able to get it going with literally 3 simple lines in the .build file.

My example code is based on FLTK's basic sample:
www.fltk.org/doc-1.3/basics.html

Meson's official guide:
mesonbuild.com/Quick-guide.html
>>1057
Ehh, may as well post the code itself just in case.

> main.cpp
#include <memory>
#include <string>

#include "muh_fltk.h"

int main(int argc, char** argv)
{
using namespace std::literals;
const std::string hi_str{"Hello, /robowaifu/!"s};

auto window = std::make_unique<Fl_Window>(500, 180);
auto box = std::make_unique<Fl_Box>(20, 40, 450, 100, hi_str.c_str());
//
box->box(up_box);
box->labelfont(bold + italic);
box->labelsize(36);
box->labeltype(shadow_lbl);
//
window->end();
window->show(argc, argv);

return Fl::run();
}


> muh_fltk.h
#pragma once

#include <FL/Fl.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Window.H>

// Let's end all the shouting, shall we? :^)
auto up_box = Fl_Boxtype::FL_UP_BOX;
auto shadow_lbl = Fl_Labeltype::_FL_SHADOW_LABEL;
auto bold = FL_BOLD;
auto italic = FL_ITALIC;


> meson.build
project('test_fltk', 'cpp',
default_options : 'cpp_std=c++14')

add_project_arguments('-Wall', '-Wextra', language: 'cpp')

# Get FLTK libraries
cxx = meson.get_compiler('cpp')
fltk_dep = cxx.find_library('fltk')

srcs = ['main.cpp', ]

exe = executable('test_fltk', srcs,
dependencies : fltk_dep)

test('basic', exe)
Open file (296.66 KB 1016x601 Selection_004.png)
>>1057
Lastly, here's the guy who created the Meson project talking about it during CppCon2018.

https://www.invidio.us/watch?v=SCZLnopmYBM
Open file (93.07 KB 856x733 Selection_045.png)
>>1057
>>1058
No good reason not to use concrete objects in this case, actually.

#include <string>

#include "muh_fltk.h"

int main()
{
using namespace std::literals;
const std::string win_str{"/robowaifu/ fltk base test"s};
const std::string hi_str{"Hello, /robowaifu/!"s};

Fl_Window window{500, 180, win_str.c_str()};
Fl_Box box{20, 40, 450, 100, hi_str.c_str()};
//
box.box(up_box);
box.labelfont(bold + italic);
box.labelsize(36);
box.labeltype(shadow_lbl);
//
window.show();

return Fl::run();
}
>>1070
1) Why use std::string when you are only using the const char * values?
2) Why this: const std::string ...{"..."s};? You are;
a) Constructing a string via operator ""s
b) Constructing a string from the newly constructed string
3) Do not use something like "bold + italic". If you get used to this you will make mistakes. Use "bold | italic". You shouldn't be aliasing FLTK constants in the first place.
>>1058
because of the string literal operator s in this case keeps any problems from occurring using the slashes of '/robowaifu/' inside the string itself. otherwise i wouldn't bother. btw it works with any characters inside the string w/o worrying about side-effects, for example back-slashes (normally used for escapes ofc)
https://en.cppreference.com/w/cpp/string/basic_string/operator%22%22s

btw, if i know i have a c++17 compliant compiler on the system, then it's better to use a std::string_view instead.
https://en.cppreference.com/w/cpp/string/basic_string_view
>>1072
>Use "bold | italic". You shouldn't be aliasing FLTK constants in the first place.
actually '+' is the correct operator here, not '|', and the aliasing serves my purposes in this case as I indicated in the comment.
>>1072
BTW, there's an even more powerful string literal idiom for C++11, though clumsier:

const std::string bar{R"foo(!@@#@$#%$^&%&^%*&%?????////<<<|||)foo"};

https://en.cppreference.com/w/cpp/language/string_literal
>>1074
Well I'll eat crow, that's the weirdest API for setting flags on a font that I've ever seen.
>>1075
Not sure how this is useful here. You can just do

const char foo[] = "My program";

and now you don't even need to use .c_str(). No need to add an extra constructor call to your program startup.
>>1076
>>1076
FLTK is pretty different but it's actually a great choice for an almost universal GUI framework. I think Bjarne made a good choice of it for PPP.

>const char foo[] = "My program";
ehh, fair enough. but

const char foo[] = "Hello, \robowaifu\!";
would sure create trouble.

And besides, this is C++, not C. Raw pointers should be strictly avoided inside user code in current_year. Keep them inside library code. And quite frankly, std::string is amazing IMO.
>>1078
const char foo[] = "Hello, \\robowaifu\\!";
There.
>Raw pointers should be strictly avoided inside user code in current_year.
Please get rid of this mindset. Raw pointers will never truly go away since they're a part of your hardware's memory model. Jumping through hoops and incurring performance costs to avoid raw pointers will just cause you more trouble in the future. I'm not saying "oh use raw pointers for everything STL bad", but there are some situations where having a raw pointer doesn't hurt whatsoever.
>And quite frankly, std::string is amazing IMO.
It's just a struct holding a char*, a length and a capacity. It has its own place. You don't need to run std::basic_string<char>::basic_string(stdd::basic_string<char>) for every string you create, especially since you only care about the char* in this context.
>>1079
mine's prettier. :^)
"make programming enjoyable" is a fundamental design goal of C++.

>please get rid of this
no thanks. i programmed in C for two years before learning C++. i'll stick with the latter. i'm well aware of the need for raw pointers but as i said, keep them in library code where they rightfully belong.

std::string is doing much more than just that tbh. RAII is so fundamental the the C++ Tao that i'll never go back. i'll literally go out of my way to write extensive library code first just so the effort of writing large codebases becomes much easier and more reliable.
>>1080
"Make programming enjoyable" is a fundamental design goal of C++? Funny, whenever I write code in C++ I feel like I am pulling out my nails one by one.
>no thanks.
Oh well, carry on then. Good luck.
>>1081
kek. OK I misquoted.
>"...more enjoyable." :^)

Heh, I understand. Like other large languages it takes time and effort to master. IMO it's time & effort well-spent. There are no perfect languages, but if you're going to create ginormous systems like robowaifus will be, then C++ is literally the best language in the world to use for it. That's why I'm here, actually.
>>521
Ehh, I just realized that the final file out segment of this code would be semantically more sensible using C++17's structured binding feature. So, rather than using obtuse terms like e.first.second etc, the output stream can use more specific ones like img & subj. The final types within the stream are unchanged from the original (size_t, size_t, & string), only now they have more suggestive variable naming.

// file out
const std::string outfile{"catalog_ranked"};
std::fstream ofs(outfile, ofs.out);
//
for (const auto& e : thread_map) {
const auto [rep, img]{e.first};
const auto& subj{e.second};

ofs << "[" << rep << "] [" << img << "]"
<< " " << subj << '\n';
}


https://en.cppreference.com/w/cpp/language/structured_binding
Edited last time by Chobitsu on 10/04/2019 (Fri) 06:15:53.
>>1072
>>1076
>>1079
>>1081
BTW, thanks anon. I appreciate the input, it's welcome anytime.
Ehh, I just realized I overlooked mentioning the C++ Core Guidelines. It's a group effort on the part of top C++ developers to coalesce the language around a set of core principles the language is remarkably good at, and to move away from the legacy language issues (primarily still there to ensure compatibility with C) that have been troublesome in the past.

While led by several top ISO C++ Committee members (founded by Bjarne himself as well as the committee Chair Herb Sutter), it is a non-sanctioned pirate ARRRGH, Matey! organization. It is actively maintained and has now become a strong influence guiding the future of C++, as the founders intended. Think of it as an agile way for the Good Guys™ to skirt the bureaucratic Committee members.

Here's an example guideline related to the incredibly important computer science topic of RAII:
github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Re-raii
>>1270
BTW, there's a nicely rendered view of the guidelines available.
isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
>using c++
>>1281
>not using c++
>>1281
>>1282
>not using BASIC
Open file (76.76 KB 700x506 binary.jpg)
>>1281
>>1282
>>1333
plebeians all of you.
>>1281
>>1282
>>1333
>>1334
>not using brainfuck
Open file (362.32 KB 1192x894 Zima.full.32951.jpg)
>>1335
Touché. Not sure how effective that would be at creating masterful, monster powerful robowaifus though anon.
Open file (216.32 KB 512x499 eb_question3.jpg)
Open file (2.90 MB 720x720 dumbniggercooks.webm)
>>1335
>>1337 LEET
What exactly is brainfuck?
>>1338
>What exactly is brainfuck?
A meme.
>>1339
>A meme.
Oh, thanks for clearing that up.
>>1338
>ikr mr. 1337++
brainfuck is le ebin LEETHAXXORZ programming maymay language.

hello_brainfuck.bf
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Open file (112.42 KB 477x640 20390589.jpg)
OK, there's a thread begun about the ArchBot Imageboard Migration Tool up on fatchan now.
https://fatpeople.lol/tech/thread/76.html
>>1342
Are we moving to fatchan? I am confused.
>>1343
No ofc not (well, as long as julay stays up). Why do you ask anon?
>t.Chobitsu
>>1344
I misinterpreted the original statement when I saw the word "migration". Sorry about that. Thanks for clearing things up.
>>1345
The tool itself is intended to support board migrations eventually, so yeah. But no that doesn't mean we are migrating atm. I'm basically creating this tool to help the masses of BOs migrate their boards off of 8kun and onto a better bunker site somewhere else. The first step ofc is to be able to grab a full copy of the original board in a hurry, and that's what this phase of the tool does.

No worries, thanks for asking anon. I didn't realize I was generating confusion.
>>1342
I'm curious why you posted that on the /tech/ board over there when the one here has some activity.

https://julay.world/tech/
>>1347
Because the site Admin Tom there is awesome. He understands what /tech/ is actually about.
This is my first post at /robowaifu/, although i have been lurking since long before the falling of 8ch.
being a c++ programmer myself, i followed your example and tried meson (and also fltk, which is much more simple and effective than any other gui library i have seen so far).
compared with autotools, meson is not only faster, but incredibly less painful to work with.
all of this being said, the small program i made to try to use those tools is a simple text editor operated through keyboard shortcuts. it's aim is to be something like microsoft's notepad, with a focus on minimalism, customization and ease of use. i will be adding new features these days. the repository of the project https://gitlab.com/schinopsis/shlnot
i have also been tinkering with nlp, and will be posting in the AI thread once i get something that works
>>1397
Hi anon glad to hear the example worked out for you. One of the chief obstacles we have to overcome is managing a tremendous amount of complexity and dynamic activity all going on simultaneously--the vast majority of which has a hard real-time or near real-time performance constraint. Coffee languages won't do it. Neither in my opinion will C. We have to be able to build systems with both great performance and great abstraction. Otherwise we'll never succeed as a small team. C++ is quite literally the perfect language to build robowaifu software in.

Yeah, I think FLTK may not have that native look, but the FAST in Fast Light ToolKit certainly is well-named. It will serve us well imo. Yeah, Meson is pretty great. I'm frankly a little angry with myself for not picking it up earlier it would have made many things simpler haha.

Interesting little project thanks for sharing it anon. I'll clone it and have a look. A good editor is obviously an important item for any projects we'd do here that need a lot of keyboard input. The little project I've been working on will need some kind of graphical text editor soon tbh.

Yes, AI and especially NLP will be pretty vital to differentiating a robowaifu from just some kind of sexbot. Conversation and companionship are primary goals right? Looking forward to your posts.

Glad to meet you anon, welcome aboard.
>>1397
pretty sweet anon. i love the little 'micro-breadcrumbs' in the file browser. ever think about having VIM shortcuts? that would turn this into a great little editor imo.
Open file (108.34 KB 1080x698 just_play_game.jpg)
OK, so here's the newest version of the imageboard tool. It's called BUMP now. For any of you guys following along, please let me know if you find any issues with it etc.
Cheers

https://files.catbox.moe/akc819.zip
-removed libstdc++ dependency
-fully integrated functions inside the classes, no archbot.h file now
-slightly faster performance now when checking on thread bumps

https://files.catbox.moe/zlugd0.xz
-Reworked data containers to pure vectors
-a bit faster, and much simpler code now
-Added version into config file
-Consolidated Page class to hold data
-Simplified JSON management
5ac6c8e3faa99c294e92c4b5f385c7306ea5b6c5b8f369c6322d3e022b2c9034 BUMP-0.1c.tar.xz
https://files.catbox.moe/tuutsb.xz
-Added basic HTTP error reporting for catalog.json input

be0c406f005c5b4ceaee3c449ec824ceabb3f83e87210893c078bb08406f3dd7 BUMP-0.1d.tar.xz
https://files.catbox.moe/fmht9v.xz
Have an important new release today.
191106 - v0.2
-------------
-add a .sites.config file to map differing JSON schemas, to allow diff. IB s/w;
-supports lynxchan
-supports jschan (new)
-supports vichan/openib (new)
-direct archival support now included for:
julay.world
prolikewoah.com
fatpeople.lol
anon.cafe
christchannel.xyz
late.city
sportschan.org
floridachan.com
erischan.org
vch.moe
8kun.net
jthnx5wyvjvzsxtu.onion

-more resilient in the face of network errors
-add use of OP's comment as thread directory name if subject field is blank
-extend thread directory ID pad suffix to adapt to higher post ID numbers
-add download progress message scroll
-add a file 404 record for a failed download attempt (skips re-attempting later)

1edee477f9de708d73b8c0555a0eaba7c91d7e437b114e209b6501c4f427112d BUMP-0.2.tar.xz
https://files.catbox.moe/1g4lqu.xz
>>1460
Add useragent to tool, and patched minor bug.
191106 - v0.2a
--------------
-patch '<="bump_v0.2"' bug
-add bump useragent

dc09d8f6ec38f5e4d020eaf3d187fa8404d21944c23427f914a8bb820d51848a BUMP-0.2a.tar.xz
https://files.catbox.moe/9xfs89.xz
>>1460
>>1461
Hey, this is Robi. Wanna help me add support for different imageboards on https://gitgud.io/rb/MultiScraper ? I am trying to also add support for importing scraped threads.
>>1462
Oh hey there Robi. Sorry I missed this. Sure, but I'm not much of a dev outside of C++ tbh. If you think that would work then I'm your guy.
>>1462
Hey Robi, question. I've never run an IB before (or even installed one). Do you think I'll need an install of Lynxchan running to help out with this project?
191115 - v0.2b
--------------
-direct archival support now included for:
endchan.net
8kun.us

-add notification for new thread discovery
-add apostrophe handling in filenames
-patch bug with filename extension handling
-patch minor bug causing unnecessary rechecking of un-bumped threads
-add 'file empty' record similar to file 404 record (skips re-attempting later)
-add minor optimization when force-rechecking a thread's files
-extend DL timeout to 90 secs to better accommodate endchan's large filesizes
-add special check for MongoDB crash
-add thread's ID prefix to the 'file_404s.json' file
-add 'deleted' file download bypass
-patch minor bug w/ force re-checking of threads

https://files.catbox.moe/0y7z6j.xz
0b43b392ea2b69de1bb7d83c1c4714e473763629060c7f05f5dde4bd32a1dfa1 BUMP-0.2b.tar.xz


Since this is taking me longer to get the duplicate file management in place, I'll just put it off until a v0.2c release and go ahead and put what I have out there now, since endchan.net is now included and there's a couple of bugfixes that help alleviate some nuisance. Cheers.
191121 - v0.2c
--------------
-direct archival support now included for:
lainchan.org
arisuchan.jp
8kun.top

-add timeout error code 9001 - interim step towards better error correction
-extend DL timeout out to 120sec to pick up even longer downloads (good for TOR)
-add space handling in filenames
-make minor output message adjustments
-add somewhat better validation of 'catalog.json' files
-add facility for cleanly re-acquiring any accidentally deleted thread folders
f76855c247ea4243f5e3fb98b52a1ebdd4759e86d815de148e7d77f9d6e96495 BUMP-0.2c.tar.xz
https://files.catbox.moe/bvccj0.xz


Alright, I've decided to go ahead and make another subrelease earlier since 8kun.top seems to be working atm. I'll be doing a pretty significant revamping of the Page class' data management, so I'll hold off on the dupe files handling until then.
>>1523
Hmm, looks like that was a bit premature. Apparently VanwaTech's system allows browsers OK for 8kun.top, but is rejecting BUMP--probably all types of bots. Might need to play around with the useragent, oh well.

Sorry if I got anyone's hopes up what I get for not testing heh (it still works fine with 8kun's onion service jthnx5wyvjvzsxtu.onion, use torify).
Someone complained that they were interested in the software, but they were confused how to get everything set up to build BUMP. I created a INSTALL file for Ubuntu that I hope helps. If anything's unclear or you experience some difficulty with these instructions, I'd appreciate knowing about it, thanks. I'll include this file when I make the next release.

>Install.txt
Here are detailed setup instructions for BUMP from a clean install of Ubuntu 19.10:

1. Execute this command from a terminal:
sudo apt-get install meson ninja-build libcurl4-openssl-dev libfltk1.3-dev libjsoncpp-dev

-this will get you set up with required developer libraries

2. Clone and build juci++ (instructions located at):
https://gitlab.com/cppit/jucipp/blob/master/docs/install.md#debianlinux-mintubuntu

-installing this will get you set up with the basic latest dev environment and other rereqs,
not to mention being a powerful little FOSS C & C++ IDE.

3. Clone and build curlpp:
git clone https://github.com/JosephP91/curlcpp.git
cd curlcpp/ && mkdir build && cd build
cmake .. && make
sudo make install

4. May as well use Juci to build BUMP software since you have Juci now. From the directory
where you extracted the (inside) BUMP archive, run this from the terminal:
juci .

5. Inside Juci, compile and run the BUMP code:
Project > Compile and Run (Ctrl+Return)

-you should see an error about 'program argument error' from BUMP. These can be added under:
Project > Set Run Arguments
(for example):
bump julay.world ck

You should be all set to archive literally any board for every site included in the .sites.config
file. BUMP is pretty smart about figuring out what needs to be updated in future runs and only grabs
what's changed. Also, it will probably be easier to just run BUMP from the terminal afterwards tbh.
BTW there's a new /robowaifu/-oriented C++ & OpenGL project begun in the RW Simulator thread (just in case any C++ anons here missed it).
>>1814
I've been working on learning functional C++ code here's a simple example of the idea. int main() { vector<int> ints{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; auto even = [](int i) { return 0 == i % 2; }; auto square = [](int i) { return i * i; }; for (int i : ints | filter(even) | transform(square)) { cout << i << ' '; } cout << '\n'; } this outputs: 0 4 16 36 64 100 I really like this style of coding and I'm really glad ranges is finally in C++20. https://en.cppreference.com/w/cpp/ranges Until GCC 9.3 arrives, I'm just using Eric Niebler's library for now. code: https://privatebin.net/?e15accfb31d0132c#EW58fwas6hHJdr8AA8qgQuPHV18hbmtTJr1NZNJRZbim
heh for some reason private bin ditched the includes: #include <iostream> #include <vector> using std::cout; using std::vector; #include <range/v3/view/filter.hpp> #include <range/v3/view/transform.hpp> using namespace ranges; using views::filter; using views::transform;
>>1945 here's another toy example that demonstrates ranges lazy-evaluation: // lazyEvaluation.cpp #include <cstdio> #include <tuple> #include <range/v3/all.hpp> using namespace ranges; decltype(auto) pairs(const char* foo) { return views::zip_with([](int c, auto i) { return std::make_pair(c, i); }, views::c_str(foo), views::ints(0, unreachable)); } int main() { for (const auto [c, i] : pairs("ROBOWAIFU")) { printf("(%c,%i) ", c, i); } printf("\n\n"); } outputs: (R,0) (O,1) (B,2) (O,3) (W,4) (A,5) (I,6) (F,7) (U,8) the views::ints(0, unreachable) call is an iota-view from zero to infinity, but because of lazy evaluation it only returns the proper numbers of elements.
Open file (2.12 MB 849x1315 wg21-1990-2020.png)
The C++20 standard was finalized last month. I think it addresses a couple of key features that have long been missing, modules & coroutines. Modules are a fundamental game-changer for the entire C culture IMO. Coroutines have been done using C++ in one form or another for decades but always as some type of custom solution. Having them in the standard itself will help dismantle proprietary-only approaches, and will certainly improve concurrency in general. Personally, ranges are the biggest change to my own programming style so far, but it's not really something fundamental like modules, but rather more of a sophistication layered on top of Stepanov's breakthroughs. https://isocpp.org//blog/2020/02/bjarne-stroustrup-on-cpp20s-significance https://invidio.us/watch?v=03BtQljH2oA
>>1994 >The C++20 standard was finalized last month A significant number of committee members post on the r/cpp subreddit i know, w/e :^) I rendered a pdf of the page discussing the Prague meeting. old.reddit.com/r/cpp/comments/f47x4o/202002_prague_iso_c_committee_trip_report_c20_is/ there are also a number of important discussions going on in the working groups that will have a future impact in AI/ML & embedded using the standard C++ library, and therefore are important for the future of robowaifus. EG: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1708r2.pdf http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2072r0.pdf http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1709r2.pdf cheers.
>>1999 meant to add this link on the deterministic exceptions in c++ proposal. this need is a significant issue in the real-time kernel of a robowaifu, and will be a huge boon if adopted in the standard. https://www.research.ed.ac.uk/portal/files/78829292/low_cost_deterministic_C_exceptions_for_embedded_systems.pdf
>>1994 Here's a pretty nice item about C++20 ranges. I learned a few things. https://hannes.hauswedell.net/post/2019/11/30/range_intro/
>>2024 >main.cpp #include <taskflow/taskflow.hpp> // Cpp-Taskflow is header-only int main() { tf::Executor executor; tf::Taskflow taskflow; auto [A, B, C, D] = taskflow.emplace( []() { std::cout << "TaskA\n"; }, // task dependency graph []() { std::cout << "TaskB\n"; }, // []() { std::cout << "TaskC\n"; }, // +---+ []() { std::cout << "TaskD\n"; } // +---->| B |-----+ ); // | +---+ | // +---+ +-v-+ A.precede(B); // A runs before B // | A | | D | A.precede(C); // A runs before C // +---+ +-^-+ B.precede(D); // B runs before D // | +---+ | C.precede(D); // C runs before D // +---->| C |-----+ // +---+ executor.run(taskflow).wait(); return 0; } > meson.build project('taskflow', 'cpp') add_project_arguments('-std=c++2a', '-Wall', '-Wextra', language: 'cpp') cxx = meson.get_compiler('cpp') thrd_dep = cxx.find_library('pthread') executable('taskflow', 'main.cpp', dependencies : thrd_dep) >outputs TaskA TaskC TaskB TaskD
Open file (90.55 KB 882x679 juCi++_069.png)
Intel has sponsored the book now, so it's free for anyone interested in TBB (also opensauce now). https://link.springer.com/book/10.1007%2F978-1-4842-4398-5 https://github.com/oneapi-src/oneTBB
Open file (1.20 MB 6972x1583 performance.jpg)
>>2028 BTW, for anyone who's never dabbled into the incredibly complex world of concurrency and parallelization, this model's approach is remarkable in it's ease of use & resiliency. i haven't had a chance to profile anything with it just yet, but according to the published numbers in their paper, it's also notably higher performance than the two major parallelization/concurrency frameworks OpenMP & TBB.
>>2020 Once we get into a large system of complex dynamics and having to sort out in realtime lots and lots of signal needles inside noise haystacks, I may look into this libraries performance as an optimization. https://github.com/orlp/pdqsort
Open file (37.07 KB 673x454 pdqsort_perf_comp.png)
Another curated list of C++ libraries. The location itself of the list adds a fair measure of credence to the legitimacy of the selections. https://en.cppreference.com/w/cpp/links/libs
>>215 I realized I hadn't posted an updated a copy here since C++20 was voted in. So, I just personally rendered the typeset from the official TeX draft sources themselves https://github.com/cplusplus/draft , so this is literally as current atm as anywhere else. Read it right here on /robowaifu/ first nerds! :^) >Working Draft, Standard for Programming Language C++, 2020-05-15, 1'834pp
C++ Several C++20 features have been implemented: P1668R1, Permitting Unevaluated inline-assembly in constexpr Functions P1161R3, Deprecate a[b,c] P0848R3, Conditionally Trivial Special Member Functions P1091R3, Extending structured bindings P1143R2, Adding the constinit keyword P1152R4, Deprecating volatile P0388R4, Permit conversions to arrays of unknown bound P0784R7, constexpr new Concepts, including P0734R0, P0857R0, P1084R2, P1141R2, P0848R3, P1616R1, P1452R2 P1301R4, [[nodiscard("with reason")]] P1814R0, class template argument deduction for alias templates P1816R0, class template argument deduction for aggregates P0960R3, Parenthesized initialization of aggregates P1331R2, Allow trivial default initialization in constexpr contexts P1327R1, Allowing dynamic_cast and polymorphic typeid in constexpr contexts P0912R5, Coroutines (requires -fcoroutines) Several C++ Defect Reports have been resolved, e.g.: DR 1560, lvalue-to-rvalue conversion in ?: DR 1813, __is_standard_layout for a class with repeated bases DR 2094, volatile scalars are trivially copyable, DR 2096, constraints on literal unions DR 2413, typename in conversion-function-ids DR 2352, Similar types and reference binding DR 1601, Promotion of enumeration with fixed underlying type DR 330, Qualification conversions and pointers to arrays of pointers DR 1307, Overload resolution based on size of array initializer-list DR 1710, Missing template keyword in class-or-decltype New warnings: -Wmismatched-tags, disabled by default, warns about declarations of structs, classes, and class templates and their specializations with a class-key that does not match either the definition or the first declaration if no definition is provided. The option is provided to ease portability to Windows-based compilers. -Wredundant-tags, disabled by default, warns about redundant class-key and enum-key in contexts where the key can be eliminated without causing an syntactic ambiguity. G++ can now detect modifying constant objects in constexpr evaluation (which is undefined behavior). G++ no longer emits bogus -Wsign-conversion warnings with explicit casts. Narrowing is now detected in more contexts (e.g., case values). Memory consumption of the compiler has been reduced in constexpr evaluation. The noexcept-specifier is now properly treated as a complete-class context as per [class.mem]. The attribute deprecated can now be used on namespaces too. The ABI of passing and returning certain C++ classes by value changed on several targets in GCC 10, including AArch64, ARM, PowerPC ELFv2, S/390 and Itanium. These changes affect classes with a zero-sized subobject (an empty base class, or data member with the [[no_unique_address]] attribute) where all other non-static data members have the same type (this is called a "homogeneous aggregate" in some ABI specifications, or if there is only one such member, a "single element"). In -std=c++17 and -std=c++20 modes, classes with an empty base class were not considered to have a single element or to be a homogeneous aggregate, and so could be passed differently (in the wrong registers or at the wrong stack address). This could make code compiled with -std=c++17 and -std=c++14 ABI incompatible. This has been corrected and the empty bases are ignored in those ABI decisions, so functions compiled with -std=c++14 and -std=c++17 are now ABI compatible again. Example: struct empty {}; struct S : empty { float f; }; void f(S);. Similarly, in classes containing non-static data members with empty class types using the C++20 [[no_unique_address]] attribute, those members weren't ignored in the ABI argument passing decisions as they should be. Both of these ABI changes are now diagnosed with -Wpsabi.
>>3187 I neglected to list the improvments in libstdc++ Runtime Library (libstdc++) Improved experimental C++2a support, including: Library concepts in <concepts> and <iterator>. Constrained algorithms in <ranges>, <algorithm>, and <memory> (thanks to Patrick Palka). New algorithms shift_left and shift_right (thanks to Patrick Palka). std::span (thanks to JeanHeyd Meneide). Three-way comparisons in <compare> and throughout the library. Constexpr support in <algorithm> and elsewhere (thanks to Edward Smith-Rowland). <stop_token> and std::jthread (thanks to Thomas Rodgers). std::atomic_ref and std::atomic<floating point>. Integer comparison functions (cmp_equal, cmp_less etc.). std::ssize, std::to_array. std::construct_at, std::destroy, constexpr std::allocator. Mathematical constants in <numbers>. Support for RDSEED in std::random_device. Reduced header dependencies, leading to faster compilation for some code.
Codeplay has a Community Edition of their SYCL (single-source heterogeneous computing--ie, run your standard C++ code directly on GPUs) implementation. SYCL is an open standard controlled by Khronos. https://developer.codeplay.com/home/ https://www.khronos.org/sycl/
>>3248 I finally installed GCC10.1 today and this now works right out of the box: >muh_ranges.cpp #include <iostream> #include <ranges> #include <vector> using std::views::filter; using std::views::transform; int main() { std::vector ints{0, 1, 2, 3, 4, 5}; auto even = [](int i) { return 0 == i % 2; }; auto square = [](int i) { return i * i; }; for (int i : ints | filter(even) | transform(square)) { std::cout << i << ' '; } std::cout << std::endl; } >outputs: 0 4 16 All that needs to be done with your build file to enable this is simply to specify C++20 as the standard: >meson.build project('muh_ranges_tst', 'cpp') add_project_arguments('-std=c++20', '-Wall', '-Wextra', language: 'cpp') executable('muh_ranges_tst', 'muh_ranges.cpp') This has been a long wait and I'm pretty stoked tbh. While there are a lot of other improvements to C++20, ranges was the biggest one for me personally. This will literally change all my future C++ code for the better. Give it a couple more standard revs and it will probably be easier to read in most cases than even Python.
Open file (83.24 KB 865x637 juCi++_099.png)
>>3682 The dream is alive. :^)
>>3682 >>3693 I just found out you can integrate the ranges piping directly on the primary argument for the for_each() algo: #include <algorithm> #include <iostream> #include <ranges> #include <vector> using std::ranges::for_each; using std::ranges::sort; using std::views::filter; using std::views::transform; auto print = [](const auto e) { std::cout << e << ' '; }; auto even = [](const int i) { return 0 == i % 2; }; auto square = [](const auto i) { return i * i; }; int main() { std::vector ints{5, 7, 4, 2, 8, 6, 1, 9, 0, 3}; sort(ints); for_each(ints | filter(even) | transform(square), print); std::cout << std::endl; } >outputs: 0 4 16 36 64
Any professional C++ developers who have needed to solve determinate template specialization (at compile-time ofc), or have had to wade through 100+ long error messages in the past will appreciate C++20 concepts. You can use any of the builtin concepts, create your own, and also compose them: >muh_constraints.cpp // https://en.cppreference.com/w/cpp/language/constraints #include <concepts> #include <iostream> #include <type_traits> using uint = unsigned; template <class T> concept Integral = std::is_integral<T>::value; template <class T> concept SignedIntegral = Integral<T> && std::is_signed<T>::value; template <class T> concept UnsignedIntegral = Integral<T> && ! SignedIntegral<T>; // constrained C++20 function template template <SignedIntegral T> void z(T) { std::cout << "signed\n"; } // constrained C++20 function template template <UnsignedIntegral T> void z(T) { std::cout << "unsigned\n"; } int main() { z(1); z(uint(1)); std::cout << std::endl; } >outputs: signed unsigned
Edited last time by Chobitsu on 06/03/2020 (Wed) 14:33:41.
Normal functions and template functions can effectively be equivalent now in C++20. Consider a trivial GCD example. Though calculating a greatest common divisor can be tedious and error-prone for the non-maths types like me, the standard library provides a GCD function, but it's on you the programmer to ensure the arguments passed to it satisfy specific constraints beforehand, or the code is either undefined or ill-formed. Tn the past this maybe meant writing verbose tests and perhaps specializing template code, but with C++20 concepts, you can now combine constraints (such as Integral) with the auto keyword, and get template functions directly by just writing normal functions. This is a big step towards true unification of generic programming and standard programming. In the history of the language until now, these have generally been pretty distinct. Note the remark in the std::gcd, and how it's satisfied by the Integral constraint we created. >gcd_foo.cpp /*https://en.cppreference.com/w/cpp/numeric/gcd Computes the greatest common divisor of the integers m and n. Remarks If either M or N is not an integer type, or if either is (possibly cv-qualified) bool, the program is ill-formed. */ #include <iostream> #include <numeric> #include <type_traits> // C++20 concept template <typename T> concept Integral = std::is_integral<T>::value; using std::cout; // C++20 constrained (normal) function Integral auto muh_gcd(Integral auto m, Integral auto n) { return std::gcd(m, n); } int main() { cout << "gcd(1,0): " << muh_gcd(1, 0) << '\n'; cout << "gcd(-100,100): " << muh_gcd(-100, 100) << '\n'; cout << "gcd(10,100): " << muh_gcd(10, 100) << '\n'; cout << "gcd(1071, 462): " << muh_gcd(1071, 462) << '\n'; // ill-formed, and will be caught at compile-time with muh_gcd() // cout << "gcd(3.14,6.28): " << muh_gcd(3.14, 6.28) << '\n'; // cout << "gcd(true,false): " << muh_gcd(true, false) << '\n'; cout << std::endl; } >outputs: gcd(1,0): 1 gcd(-100,100): 100 gcd(10,100): 10 gcd(1071, 462): 21
>>3712 Again note, this is all generated template code in the end. These calls are pre-computed as constants at compile-time. No runtime costs. Multiply that by billions of items, and the value of normal_functions==generic_functions starts to come into focus.
Note that when using C++20 concepts, the C++ compiler will still properly select functions from the candidates just as normal. Consider an overload to add two parameters: #include <iostream> #include <string> #include <type_traits> template <typename T> concept Arithmetic = std::is_arithmetic<T>::value; using std::cout; // C++20 constrained function Arithmetic auto muh_add(Arithmetic auto A, Arithmetic auto B) { cout << "Arithmetic\t"; return A + B; } // C++17 generic function auto muh_add(auto A, auto B) { cout << "auto\t\t"; return A + B; } int main() { cout << "muh_add(6, 5): " << muh_add(6, 5) << '\n'; // ints cout << "muh_add(5.5, 5): " << muh_add(5.5, 5) << '\n'; // doubles std::string foo{"robo"}, bar{"waifu"}; cout << "muh_add(foo, bar): " << muh_add(foo, bar)<< '\n'; // strings cout << std::endl; } >outputs muh_add(6, 5): Arithmetic 11 muh_add(5.5, 5): Arithmetic 10.5 muh_add(foo, bar): auto robowaifu Of the 3 calls to muh_add(), for the first two the compiler chooses the Arithmetic constrained function (and each type uses the overloaded operator '+'). For the last one the compiler correctly determines that a std::string is not an Arithmetic type and finds the second, generic candidate. This function uses the overloaded operator '+' as well for concatenating the two strings.
>>3704 >>3712 >>3717 BTW, if any Anons want to dabble around with concepts, be aware these examples are merely expository-only, and not intended for production. Basically, don't roll-your-own when you don't have to. Even when you do, you should be composing the new concepts out of the official standard library ones. (see this list https://en.cppreference.com/w/cpp/concepts ) For example, there is already a std::integral concept in the C++20 standard. https://en.cppreference.com/w/cpp/concepts/integral
Curated C++ Performance List Maintained by Bartłomiej Filipek, whose no slouch in this domain himself. https://github.com/fenbf/AwesomePerfCpp
Bjarne just released a mini-synopsis of C++ over the last ~15yrs. 168p. >By 2006, C++ had been in widespread industrial use for 20 years. It contained parts that had survived unchanged since introduced into C in the early 1970s as well as features that were novel in the early 2000s. From 2006 to 2020, the C++ developer community grew from about 3 million to about 4.5 million. It was a period where new programming models emerged, hardware architectures evolved, new application domains gained massive importance, and quite a few well-financed and professionally marketed languages fought for dominance. How did C++ ś an older language without serious commercial backing ś manage to thrive in the face of all that? >This paper focuses on the major changes to the ISO C++ standard for the 2011, 2014, 2017, and 2020 revisions. The standard library is about 3/4 of the C++20 standard, but this paper’s primary focus is on language features and the programming techniques they support. The paper contains long lists of features documenting the growth of C++. Significant technical points are discussed and illustrated with short code fragments. In addition, it presents some failed proposals and the discussions that led to their failure. It offers a perspective on the bewildering flow of facts and features across the years. The emphasis is on the ideas, people, and processes that shaped the language. >Themes include efforts to preserve the essence of C++ through evolutionary changes, to simplify its use, to improve support for generic programming, to better support compile-time programming, to extend support for concurrency and parallel programming, and to maintain stable support for decades’ old code. >The ISO C++ standard evolves through a consensus process. Inevitably, there is competition among proposals and clashes (usually polite ones) over direction, design philosophies, and principles. The committee is now larger and more active than ever, with as many as 250 people turning up to week-long meetings three times a year and many more taking part electronically. We try (not always successfully) to mitigate the effects of design by committee, bureaucratic paralysis, and excessive enthusiasm for a variety of language fashions. >Specific language-technical topics include the memory model, concurrency and parallelism, compile-time computation, move-semantics, exceptions, lambda expressions, and modules. Designing a mechanism for specifying a template’s requirements on its arguments that is sufficiently flexible and precise yet doesn’t impose run-time costs turned out to be hard. The repeated attempts to design łconceptsž to do that have their roots back in the 1980s and touch upon many key design issues for C++ and for generic programming. >The description is based on personal participation in the key events and design decisions, backed by the thousands of papers and hundreds of meeting minutes in the ISO C++ standards committee’s archives. >--- Actually, this looks to be an addition to ACM's next HOPL, which is an important and relatively rare (the next HOPL will be only the 4th in the ACM's 70+ years) event. If so, and if I'm not entirely mistaken, then that puts Bjarne into the sole unique club of having 3 entries in HOPL. Along with his Turing Award that marks quite a legacy for his career.
Edited last time by Chobitsu on 06/20/2020 (Sat) 16:39:36.
>>3855 >Actually, this looks to be an addition to ACM's next HOPL, which is an important and relatively rare (the next HOPL will be only the 4th in the ACM's 70+ years) event. If so, and if I'm not entirely mistaken, then that puts Bjarne into the sole unique club of having 3 entries in HOPL. Along with his Turing Award that marks quite a legacy for his career. Both now confirmed. >"...With this paper, C++ becomes the first and only language to be presented three times at HOPL and I become the first and only person to present three times. HOPL happens every 15 years. The other papers are now accessible as the Proceedings of the ACM on Programming Languages, Volume 4, Issue HOPL, June 2020: https://dl.acm.org/toc/pacmpl/" http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2184r0.pdf
>>4116 final edit here. >
How are you supposed to run this on a microcontroller inside a robots head?
>>4123 Hey Anon, so we're kind of divided as a group about where to place the compute resources for a robowaifu. Some of us think we should keep the sensitive SBCs inside a shielded little 'breadbox' inside the robowaifu's chest to keep it safe from RF interference and physical shock/damage. Others of us think the biomemetic approach is best and want to put the SBCs inside the head. The little microcontrollers can (and will) be distributed around the robowaifu's body generally near where they are needed, and all networked together. Just fyi, we have a thread about these devices. >>16 >Single board computers & micro-controllers
>>648 Not sure why I didn't just post the book itself.

Report/Delete/Moderation Forms
Delete
Report

Captcha (required for reports and bans by board staff)

no cookies?