#新手 要怎麼確認lookup table真的有在compile time被算出來?

原本把a或A轉成的1程式 我在runtime解決
megapx
我後來覺得這個表可以在compile time解決
megapx
請問這樣真的有在compile time完成嗎? 還是一樣是在run time才知道alphbetToInt('a')是1? 我其實希望有一個vector<int> aToI(128,0) aToI['a']會是1 一直到aToI['z']會是'z' - 'a' + 1 但是在compile time完成這件事 因為independent of input 我不想要一行一行自己寫 但是我不知道要怎麼寫出在compile time跑的for迴圈
愛心
4
20
全部留言