並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 38 件 / 38件

新着順 人気順

std vector sort cの検索結果1 - 38 件 / 38件

  • 関数名、メソッド名、変数名でよく使う英単語のまとめ

    プログラミングをしていると関数名、メソッド名、変数名をどうするか悩みます。 ロジックより命名に時間を費やすこともざらにあります。翻訳したり、一般的な命名規則なのかいつも検索して大変です。 よく使うサイトの内容をコピってメモしておく 関数名とメソッド名の違いについて よく使う英単語のまえに、いつもごっちゃにして使っているけど、定義はこんな感じ 「関数」と「メソッド」の違い 似ているところ どちらも何か(引数)を入れると処理をして何か(戻り値)を返してくれます。 違うところ やってること自体は大差ありません。概念としては違います。 メソッドはオブジェクト指向で登場する用語で、オブジェクトの動作を定義したものです。 まずオブジェクトありきなのですね。一方の関数は、オブジェクト云々は関係ありません。 個人的な使い分け Java で登場する関数は「メソッド」です。C 言語で登場する関数は「関数」と呼

      関数名、メソッド名、変数名でよく使う英単語のまとめ
    • 2023年のコンパイル時レイトレーシング - in neuro

      これは qiita.com の12/16の記事です。やばいもう16日が終わってしまう! はじめに 太古の昔、あるC++プログラマ*1がtemplateの再帰と特殊化を使ってコンパイル時に計算ができることを「発見」*2*3したその日から、C++とコンパイル時計算は分かちがたく結びついています。 言語機能を本来意図されていなかった方法で活用する曲芸的な技巧だったコンパイル時計算は、その強力さを買われコミュニティを席巻し、C++11での constexpr の導入によりある意味で公式に認められたものとなりました。 導入当初は return 文一つだけしか持てなかった constexpr 関数は、それでも三項演算子による条件分岐や再帰によってコンパイル時計算を大いに盛り上げました。 そしてC++14で条件分岐、ループ、変数の書き換えが、C++17ではラムダが、C++20では仮想関数と動的メモリ確保

        2023年のコンパイル時レイトレーシング - in neuro
      • Prototyping in Rust | corrode Rust Consulting

        Programming is an iterative process. As much as we would like to come up with the perfect solution from the start, it rarely works that way. Good programs often begin as quick prototypes. While many experiments remain prototypes, the best programs can evolve into production code. Whether you’re writing games, CLI tools, or designing library APIs, prototyping helps tremendously in finding the best

          Prototyping in Rust | corrode Rust Consulting
        • Algorithms for Modern Hardware - Algorithmica

          This is an upcoming high performance computing book titled “Algorithms for Modern Hardware” by Sergey Slotin. Its intended audience is everyone from performance engineers and practical algorithm researchers to undergraduate computer science students who have just finished an advanced algorithms course and want to learn more practical ways to speed up a program than by going from $O(n \log n)$ to $

          • 大学生は『競プロ』と『kaggle』をやろう!

            はじめに みなさん、こんにちは。EpicAIでエンジニアをしている森岡です。大学生になって受験勉強から解放され、目標を失っている人は多いのではないでしょうか。大学では高校生の頃のような過剰な受験戦争や部活などから一度解放されることとなります。 その結果多くの人は恋愛を楽しんだり、サークル活動やバイトに注力したりします。もちろん、そのような生活も大事ですが、何か物足りなくないですか?新しい目標を見つけたくないですか? 大学の貴重な4年や6年を何か有意義なことに使いたいと考えている人も多いのではないでしょうか。しかし、そういう人が行き着く先といえば、たいてい大学のGPAやTOEICなどになっています。もちろん、これらも素晴らしいと思いますが、何かもっと自分は可能性を秘めているのではないか?もっと自分が打ち込める面白いやりこみ要素があるものがないか?そう思っている人も多いと思います。 そんなあな

              大学生は『競プロ』と『kaggle』をやろう!
            • Changing std::sort at Google’s Scale and Beyond

              TL;DR; We are changing std::sort in LLVM’s libcxx. That’s a long story of what it took us to get there and all possible consequences, bugs you might encounter with examples from open source. We provide some benchmarks, perspective, why we did this in the first place and what it cost us with exciting ideas from Hyrum’s Law to reinforcement learning. All changes went into open source and thus I can

                Changing std::sort at Google’s Scale and Beyond
              • RFC 9562: Universally Unique IDentifiers (UUIDs)

                 Internet Engineering Task Force (IETF) K. Davis Request for Comments: 9562 Cisco Systems Obsoletes: 4122 B. Peabody Category: Standards Track Uncloud ISSN: 2070-1721 P. Leach University of Washington May 2024 Universally Unique IDentifiers (UUIDs) Abstract This specification defines UUIDs (Universally Unique IDentifiers) -- also known as GUIDs (Globally Unique IDentifiers) -- and a Uniform Resou

                  RFC 9562: Universally Unique IDentifiers (UUIDs)
                • microgpt

                  This is a brief guide to my new art project microgpt, a single file of 200 lines of pure Python with no dependencies that trains and inferences a GPT. This file contains the full algorithmic content of what is needed: dataset of documents, tokenizer, autograd engine, a GPT-2-like neural network architecture, the Adam optimizer, training loop, and inference loop. Everything else is just efficiency.

                  • Vectorized and performance-portable Quicksort

                    The latest news from Google on open source releases, major projects, events, and outreach programs for early career developers. Today we're sharing open source code that can sort arrays of numbers about ten times as fast as the C++ std::sort, and outperforms state of the art architecture-specific algorithms, while being portable across all modern CPU architectures. Below we discuss how we achieved

                      Vectorized and performance-portable Quicksort
                    • The life and times of an Abstract Syntax Tree

                      You’ve reached computer programming nirvana. Your journey has led you down many paths, including believing that God wrote the universe in LISP, but now the truth is clear in your mind: every problem can be solved by writing one more compiler. It’s true. Even our soon-to-be artificially intelligent overlords are nothing but compilers, just as the legends foretold. That smart contract you’ve been wr

                        The life and times of an Abstract Syntax Tree
                      • ビームサーチの上位 N件を高速に取る手法について考えてみる

                        ビームサーチでは候補となるノードを評価してその上位 N件を取得する処理が必要になるのですが、この部分をどう実装するのが高速なのかが度々話題になったりならなかったりします。 候補としては以下の 4つになります。(C++) sort nth_element partial_sort priority_queue 気になったので簡易的なコードを書いて実験してみました。(10万回ランダムに値を生成して、その中の値の小さい方から 100件を取得する。それを 1000回繰り返すコード) sort ver #include <algorithm> #include <iostream> #include <chrono> #include <vector> using namespace std; using namespace std::chrono; typedef long long ll; in

                          ビームサーチの上位 N件を高速に取る手法について考えてみる
                        • Building the Rust compiler with GCC

                          Bootstrapping Rust with GCC If you know one thing about me, it is that I love working on the Rust compiler. Some people kayak, travel or play guitar - and I stare at assembly, trying to figure out what I broke. This summer, I am taking on quite a large task: bootstrapping the Rust compiler using `cg_gcc` What does that mean? "bootstrapping" is simply a name given to the Rust compiler build process

                          • The V8 Sandbox · V8

                            After almost three years since the initial design document and hundreds of CLs in the meantime, the V8 Sandbox — a lightweight, in-process sandbox for V8 — has now progressed to the point where it is no longer considered an experimental security feature. Starting today, the V8 Sandbox is included in Chrome's Vulnerability Reward Program (VRP). While there are still a number of issues to resolve be

                            • Trivia About Rust Types: An (Authorized) Transcription of Jon Gjengset's Twitter Thread

                              Preface (by Jimmy Hartzell) I am a huge fan of Jon Gjengset’s Rust for Rustaceans, an excellent book to bridge the gap between beginner Rust programming skills and becoming a fully-functional member of the Rust community. He’s famous for his YouTube channel as well; I’ve heard good things about it (watching video instruction isn’t really my thing personally). I have also greatly enjoyed his Twitte

                              • 座標圧縮 (座圧) - けんちょんの競プロ精進記録

                                競技プログラミングで時々問われる「座標圧縮」について簡単に解説します。 1. 座標圧縮とは 数列 が与えられたときに、それぞれの要素が「全体の中で何番目に小さいか」を求めていく作業を、競プロ界では座標圧縮 (座圧) とよびます。 たとえば A = (8, 100, 33, 12, 6, 1211) に対しては、座標圧縮した結果は次のようになります。 1, 4, 3, 2, 0, 5 最も小さい数に「0」を割り当てて、小さい順に 1, 2, ... を割り当てて行っています。 同じ値があるとき 座標圧縮では、同じ値があるときは、タイは「一つの順位を占めるもの」として考えます。たとえば A = (6, 9, 9, 2, 100) に対しては、座標圧縮した結果は次のようになります。 1, 2, 2, 0, 3 コンテストの順位を決めるときのように (間違い) 1, 2, 2, 0, 4 というよ

                                  座標圧縮 (座圧) - けんちょんの競プロ精進記録
                                • 21st Century C++ – Communications of the ACM

                                  It is now 45+ years since C++ was first conceived. As planned, it evolved to meet challenges, but many developers use C++ as if it was still the previous millennium. This is suboptimal from the perspective of ease of expressing ideas, performance, reliability, and maintainability. Here, I present the key concepts on which performant, type safe, and flexible C++ software can be built: resource mana

                                  • lower_bound で混乱している人かわいそう - えびちゃんの日記

                                    言語さんサイドにも問題があるというのはそうかも。 とはいえ、理解が足りないまま「わかりにくい」と言っている人はかわいそうなので、解説をします。 名前について なんで「x 以上の最小値を得る関数」が lower_bound と呼ばれているのかわからん*1 まず、それを得る関数ではないです。イディオムとしてそう覚えてしまっているような人が多いため、こうなってしまう人が多い気はします。 実際には値ではなくイテレータを返すもので、「x と等価 (equivalent) な値がある区間の下限の位置」が返ってきます。ここでの equivalent というのは == とは違う概念なのですが、とりあえず(int のような型では)== と同一視してよいので、詳細は後述とします。 また、upper_bound についても同様で、「x より大きい最小値を得る関数」ではなく、「x と等価な値がある区間の上限の位置

                                      lower_bound で混乱している人かわいそう - えびちゃんの日記
                                    • C++ へようこそ - Modern C++

                                      C++ は、作成以来、世界で最も広く使用されているプログラミング言語の 1 つになりました。 適切に記述された C++ プログラムは、高速で効率的です。 言語は他の言語よりも柔軟性が高く、最高レベルの抽象化で動作し、シリコンのレベルで動作します。 C++ によって、高度に最適化された標準ライブラリが提供されます。 これにより、低レベルのハードウェア機能にアクセスして、速度を最大化し、メモリ要件を最小限に抑えることができます。 C++ では、ゲーム、デバイス ドライバー、HPC、クラウド、デスクトップ、埋め込み、モバイル アプリなど、ほぼすべての種類のプログラムを作成できます。 他のプログラミング言語のライブラリやコンパイラさえも C++ で作成されます。 C++ の最初の要件の 1 つは、C 言語との下位互換性でした。 その結果、C++ を使用すると常に、生ポインター、配列、null で終

                                        C++ へようこそ - Modern C++
                                      • Regex engine internals as a library - Andrew Gallant's Blog

                                        Over the last several years, I’ve rewritten Rust’s regex crate to enable better internal composition, and to make it easier to add optimizations while maintaining correctness. In the course of this rewrite I created a new crate, regex-automata, which exposes much of the regex crate internals as their own APIs for others to use. To my knowledge, this is the first regex library to expose its interna

                                        • https://cheats.rs/rust_cheat_sheet.pdf

                                          Rust Language Cheat Sheet 26. August 2021 Contains clickable links to The Book , Rust by Example , Std Docs , Nomicon , Reference . Data Structures Data types and memory locations defined via keywords. Example Explanation struct S {} Define a struct with named fields. struct S { x: T } Define struct with named field x of type T. struct S ​(T); Define "tupled" struct with numbered field .0 of type

                                          • bytecode interpreters for tiny computers ⁑ Dercuano

                                            Introduction: Density Is King (With a Tiny VM) I've previously come to the conclusion that there's little reason for using bytecode in the modern world, except in order to get more compact code, for which it can be very effective. So, what kind of a bytecode engine will give you more compact code? Suppose I want a bytecode interpreter for a very small programming environment, specifically to minim

                                            • Safer Usage Of C++

                                              Safer Usage Of C++ This document is PUBLIC. Chromium committers can comment on the original doc. If you want to comment but can’t, ping palmer@. Thanks for reading! Google-internal short link: go/safer-cpp Authors/Editors: adetaylor, palmer Contributors: ajgo, danakj, davidben, dcheng, dmitrig, enh, jannh, jdoerrie, joenotcharles, kcc, markbrand, mmoroz, mpdenton, pkasting, rsesek, tsepez, awhalle

                                              • Code Generation in Rust vs C++26

                                                One of the things I like to do is compare how different languages solve the same problem — especially when they end up having very different approaches. It’s always educational. In this case, a bunch of us have been working hard on trying to get reflection — a really transformative language feature — into C++26. Fundamentally, reflection itself can be divided into two pieces: Introspection — the a

                                                • Why Safety Profiles Failed

                                                  1 Abstract As for dangling pointers and for ownership, this model detects all possible errors. This means that we can guarantee that a program is free of uses of invalidated pointers. – A brief introduction to C++’s model for type- and resource- safety[type-and-resource-safety-2015] Safety Profiles were introduced in 2015 with the promise to detect all lifetime safety defects in existing C++ code.

                                                  • Large Text Compression Benchmark

                                                     Large Text Compression Benchmark Matt Mahoney Last update: Mar. 25, 2026. history This competition ranks lossless data compression programs by the compressed size (including the size of the decompression program) of the first 109 bytes of the XML text dump of the English version of Wikipedia on Mar. 3, 2006. About the test data. The goal of this benchmark is not to find the best overall compress

                                                    • C++20 Ranges Algorithms - 7 Non-modifying Operations

                                                      C++20’s Ranges offer alternatives for most of <algorithm>'s'. This time I’d like to show you ten non-modifying operations. We’ll compare them with the “old” standard version and see their benefits and limitations. Let’s go. Before we start Key observations for std::ranges algorithms: Ranges algorithms are defined in the <algorithm> header, while the ranges infrastructure and core types are defined

                                                        C++20 Ranges Algorithms - 7 Non-modifying Operations
                                                      • SizeBench: a new tool for analyzing Windows binary size - Performance and Diagnostics

                                                        We’ve recently released a new tool called SizeBench, which helps investigate binary size for compiled native PE files such as DLLs and EXEs. This post will talk a bit about what the tool can do and how we’ve used it inside Microsoft over the past few years as it has been developed. You can download the tool now from the Microsoft Store – just click here to get started: https://aka.ms/SizeBench Tab

                                                          SizeBench: a new tool for analyzing Windows binary size - Performance and Diagnostics
                                                        • cuneicode, and the Future of Text in C

                                                          Following up from the last post, there is a lot more we need to cover. This was intended to be the post where we talk exclusively about benchmarks and numbers. But, I have unfortunately been perfectly taunted and status-locked, like a monster whose “aggro” was pulled by a tank. The reason, of course, is due to a few folks taking issue with my outright dismissal of the C and C++ APIs (and not showi

                                                            cuneicode, and the Future of Text in C
                                                          • Text Editor Data Structures: Rethinking Undo

                                                            Undo and redo have been a staple operation of text editors probably since the first typo was ever made, yet there has not been a lot of innovation around refining the idea of what undo and redo could be. Let’s explore what I mean… On The Subject of Undo Undo In order to understand how to change undo we first need to understand what the fundamental operation of ‘undo’ is supposed to do. I have alwa

                                                              Text Editor Data Structures: Rethinking Undo
                                                            • Can GPT-4 *Actually* Write Code?

                                                              Since ChatGPT came out I’ve seen quite a lot of people posting about its capability to write code. People have posted about how they had it design and implement a number puzzle game (without realizing that that game it “invented” already exists), how they’ve had it clone pong, and hell I’ve even used it to write a few simple python utility scripts. It’s very capable, and a quite useful tool. But,

                                                                Can GPT-4 *Actually* Write Code?
                                                              • 地面を見下ろす少年の足蹴にされる私

                                                                文書の一覧 JTC1/SC22/WG21 - Papers mailing2025-12 全部で113本あります。 もくじ N5011 Brno 2026 N5029 WG21 2025-10 Kona Admin telecon minutes N5031 WG21 2025-11 Kona Minutes of Meeting N5032 Working Draft, Standard for Programming Language C++ N5033 Editors' Report - Programming Languages - C++ P1317R2 Remove return type deduction in std::apply P1789R2 Library Support for Expansion Statements P1789R3 Library Suppor

                                                                  地面を見下ろす少年の足蹴にされる私
                                                                • std::flip

                                                                  std::flip is a little-known utility from the C++ standard library header <functional>: it is a higher-order function that accepts a Callable and returns an equivalent Callable with the order of its parameters reversed (or “flipped”). To understand how it can be useful, let’s start with a simple example. Consider the following tree node class: struct node { int value; node* parent = nullptr; node*

                                                                  • One day with Zig, Raylib, and jj — Isaac Clayton

                                                                    Merry Christmas! Back from the mission, first semester at MIT is in the books! Now I am at home, with family, on a break from school. A couple days ago, I was telling my younger brother how cool Zig (the programming language) was. He was like, “if Zig is so cool, why don’t you … like, use it?” Oof. So I installed Zig, pulled in some neat bindings for raylib, and spent the afternoon writing a littl

                                                                    • 与えられた手牌をブロック(和了形)に分解するアルゴリズムについて(C++ 実装) - Qiita

                                                                      背景 麻雀の上がり(和了)において点数計算が必要となるが,それに欠かせないのが与えられた手牌をブロック(和了形)に分解するアルゴリズムである.ある手牌が複数のブロックへの分解に対応する場合があり,その中から最も点数が高くなるブロックへの分解を採用する必要がある.このことから,手牌からブロックへの分解は一筋縄ではいかない.本稿では,与えられた手牌をブロックに分解するアルゴリズムについて,大まかに4種類の方針があることを示し,これら4種類の方針が全て等価であることの数学的に厳密な証明を与える. 本稿で取り扱う問題の数学的定義 順子全体の集合,すなわち数字が3つ連続した数牌の集合を $S$ とおく. $$S = \lbrace (i, i + 1, i + 2) \ |\ 0 \leq i < 7 \vee 9 \leq i < 16 \vee 18 \leq i < 25\rbrace$$ 刻

                                                                        与えられた手牌をブロック(和了形)に分解するアルゴリズムについて(C++ 実装) - Qiita
                                                                      • Nyaan’s Library

                                                                        Nyaan's Library このライブラリは競技プログラミング用に作成したアルゴリズム・データ構造をまとめたものです。 バグや解説の誤りなどを発見した方がいましたらこちらからご一報いただけると助かります。 動作確認はg++/C++17で行っています。また、一部のライブラリはavx2命令が実行できる環境でのみ動作します。 Library Files data-structure Binary Indexed Tree(Fenwick Tree) (data-structure/binary-indexed-tree.hpp) Binary Trie (data-structure/binary-trie.hpp) data-structure/divide-interval.hpp 動的Binary Indexed Tree (data-structure/dynamic-binary-

                                                                        • exercises

                                                                          Ziglings Welcome to Ziglings! This project contains a series of tiny broken programs (and one nasty surprise). By fixing them, you'll learn how to read and write Zig code. Those broken programs need your help! (You'll also save the planet from evil aliens and help some friendly elephants stick together, which is very sweet of you.) This project was initiated by Dave Gauer and is directly inspired

                                                                            exercises
                                                                          • The RAM myth

                                                                            December 19, 2024 Reddit Hacker NewsThe RAM myth is a belief that modern computer memory resembles perfect random-access memory. Cache is seen as an optimization for small data: if it fits in L2, it’s going to be processed faster; if it doesn’t, there’s nothing we can do. Most likely, you believe that code like this is the fastest way to shard data (I’m using Python as pseudocode; pretend I used y

                                                                              The RAM myth
                                                                            • 500 Python Interpreters

                                                                              🐍 No Steppy On Threads 🐍August 19, 202417 minutes As we approach the final release date for Python 3.13, I’ve seen an uptick in discussion regarding 3.13’s introduction of an optional GIL. While removing the GIL has been a long time coming for the average user (I’ve dreamt of this for nearly 20 years), there have actually been two concurrent efforts to improve Python’s performance for multithrea

                                                                                500 Python Interpreters
                                                                              1