Skip to content

Instantly share code, notes, and snippets.

@mbohun
Last active August 16, 2025 20:55
Show Gist options
  • Save mbohun/6bd5f11296ebf6609a6c9d40f2ef1c84 to your computer and use it in GitHub Desktop.
Save mbohun/6bd5f11296ebf6609a6c9d40f2ef1c84 to your computer and use it in GitHub Desktop.
C++17
digraph ContainerDecision {
graph [rankdir=TB, fontname="Arial", nodesep=0.2];
node [shape=box, style="rounded", fontname="Arial", width=2.5, height=0.5];
edge [fontname="Arial", fontsize=10];
/* Decision Tree */
Start [label="Start: Need a container?"];
KeyValue [label="Key-Value Pairs?" shape=diamond];
Unique [label="Unique Elements?" shape=diamond];
Ordered [label="Require Ordering?" shape=diamond];
MiddleInsert [label="Frequent Middle Insertions?" shape=diamond];
FrontBack [label="Frequent Front/Back Ops?" shape=diamond];
FixedSize [label="Fixed Size?" shape=diamond];
/* Key-Value Path */
Map [label="std::map\n(Sorted tree, O(log n))"];
UnorderedMap [label="std::unordered_map\n(Hash table, O(1))"];
/* Unique Elements Path */
Set [label="std::set\n(Sorted tree, O(log n))"];
UnorderedSet [label="std::unordered_set\n(Hash table, O(1))"];
/* Sequential Path */
List [label="std::list\n(O(1) splice, O(n) access)"];
Deque [label="std::deque\n(O(1) push/pop both ends)"];
Array [label="std::array\n(Stack-allocated)"];
Vector [label="std::vector\n(Default, cache-friendly)"];
/* Edges */
Start -> KeyValue;
/* Key-Value Branch */
KeyValue -> Ordered [label="Yes"];
Ordered -> Map [label="Yes"];
Ordered -> UnorderedMap [label="No"];
KeyValue -> Unique [label="No"];
/* Unique Elements Branch */
Unique -> Ordered [label="Yes"];
Ordered -> Set [label="Yes"];
Ordered -> UnorderedSet [label="No"];
Unique -> MiddleInsert [label="No"];
/* Sequential Branch */
MiddleInsert -> List [label="Yes"];
MiddleInsert -> FrontBack [label="No"];
FrontBack -> Deque [label="Yes"];
FrontBack -> FixedSize [label="No"];
FixedSize -> Array [label="Yes"];
FixedSize -> Vector [label="No"];
/* Styling */
{rank=same; Map; UnorderedMap}
{rank=same; Set; UnorderedSet}
{rank=same; List; Deque}
{rank=same; Array; Vector}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Feature C++17 (std) Boost 1.88
Threading ✅ (std::thread) ✅ (boost::thread)
Mutexes ✅ (std::mutex) ✅ (boost::mutex)
Futures/Promises ✅ (std::future) ✅ (boost::future)
Filesystem ✅ (std::filesystem) ✅ (boost::filesystem)
Time Utilities ✅ (std::chrono) ✅ (boost::chrono)
UDP Sockets ✅ (boost::asio)
TCP Sockets ✅ (boost::asio)
HTTP/HTTPS ✅ (boost::beast)
Serialization ✅ (boost::serialization)
Regular Expressions ✅ (std::regex) ✅ (boost::regex)
Random Numbers ✅ (std::random) ✅ (boost::random)
Variant Types ✅ (std::variant) ✅ (boost::variant)
Optional Values ✅ (std::optional) ✅ (boost::optional)
String Algorithms ✅ (boost::string_algo)
Coroutines ❌ (C++20) ✅ (boost::coroutine2)
Geometry (GIS) ✅ (boost::geometry)
Graph Algorithms ✅ (boost::graph)
Interprocess Comm ✅ (boost::interprocess)
Unit Testing ✅ (boost::test)

Boost.H2 vs. Standard Hash Options

Scenario std::hash boost::hash Boost.H2
Need maximum speed ❌ Slow ❌ Slow Best (2–5x faster)
Cryptographic safety ❌ No ❌ No ✅ (SipHash optional)
Cross-platform consistency ✅ Yes ✅ Yes ✅ Yes
Tiny keys (e.g., int) ✅ Adequate ✅ Adequate ✅ Faster
Large data (GBs) ❌ Slow ❌ Slow Best (SIMD-optimized)

REFERENCES:

  • 2025-08-16: c++17 is the highest fully supported C++ standard in clang
  • TODO
@mbohun
Copy link
Author

mbohun commented Aug 7, 2025

DeepSeek AI configuration:

CONFIG: {"language":"technical", "detail_level": "high"}  
   QUESTION: Explain SDL3 sensor APIs.  
{
  "tone": "concise",
  "examples": "code-heavy",
  "avoid": ["off-topic jokes", "historical tangents"]
}

@mbohun
Copy link
Author

mbohun commented Aug 7, 2025

{
  "tone": "technical",
  "detail": "deep",
  "format": "markdown table",
  "code_lang": "C++17",
  "examples": "true",
  "humor": "none",
  "sources": "inline"
}

Then submit your question/request, for example:
Explain how UDP sockets work in SDL3.

@mbohun
Copy link
Author

mbohun commented Aug 9, 2025

graph TD
    A[Start: Need a container?] --> B{Key-Value Pairs?}
    B -->|Yes| C{Require Ordering?}
    C -->|Yes| D["std::map<br/>(Sorted tree, O(log n))"]
    C -->|No| E["std::unordered_map<br/>(Hash table, O(1))"]
    
    B -->|No| F{Unique Elements?}
    F -->|Yes| G{Require Ordering?}
    G -->|Yes| H["std::set<br/>(Sorted tree, O(log n))"]
    G -->|No| I["std::unordered_set<br/>(Hash table, O(1))"]
    
    F -->|No| J{Frequent Middle Insertions?}
    J -->|Yes| K["std::list<br/>(O(1) splice, O(n) access)"]
    J -->|No| L{Frequent Front/Back Ops?}
    L -->|Yes| M["std::deque<br/>(O(1) push/pop both ends)"]
    L -->|No| N{Fixed Size?}
    N -->|Yes| O["std::array<br/>(Stack-allocated)"]
    N -->|No| P["std::vector<br/>(Default choice, cache-friendly)"]
Loading

@mbohun
Copy link
Author

mbohun commented Aug 14, 2025

test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment