<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>toburau</author_name>
  <author_url>https://blog.hatena.ne.jp/toburau/</author_url>
  <blog_title>ゲームが作れるようになるまでがんばる日記</blog_title>
  <blog_url>https://toburau.hatenablog.jp/</blog_url>
  <categories>
    <anon>雑記</anon>
  </categories>
  <description>以前書いたソースコードをリファクタリングしていて、せっかくなので、よりC++らしくしようとしている。 そこで、以前は enum で書いていたところを enum class を使うようにした。 しかし、配列の添字として使おうとするとそのままでは使えないので、キャストをする必要がある。なので、次のような感じ。 int value = color[static_cast&lt;std::size_t&gt;(Color::kRed)]; しかし、毎回キャストを書くのも面倒。 C++23 以降なら、std::to_underlying() というのが使えるらしい。 int value = color[std::t…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftoburau.hatenablog.jp%2Fentry%2F2025%2F03%2F15%2F000000&quot; title=&quot;enum class - ゲームが作れるようになるまでがんばる日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2025-03-15 00:00:00</published>
  <title>enum class</title>
  <type>rich</type>
  <url>https://toburau.hatenablog.jp/entry/2025/03/15/000000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
