Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ベル、デシベルといった単位用のクラス作成 #51

Open
yumetodo opened this issue Mar 14, 2016 · 1 comment
Open

ベル、デシベルといった単位用のクラス作成 #51

yumetodo opened this issue Mar 14, 2016 · 1 comment
Assignees

Comments

@yumetodo
Copy link
Collaborator

#42 で必要そう。

std::chrono::durationを参考に作る

DxLibで 10^-4のオーダーが求められることがあるので(パンとか)SI単位では認められないが、myrioを導入する

@yumetodo
Copy link
Collaborator Author

namespace dxle {
    namespace literals {
        namespace sound_units_literals {
            //
        }
        using namespace sound_units_literals;
    }
    using namespace literals;

    namespace sound_units {
        using namespace literals::sound_units_literals;
    }
}

となっているんですが、

    using namespace literals;

    namespace sound_units {
        using namespace literals::sound_units_literals;
    }

これは良くない気がします・・・標準でもそうはなっていないですし
http://en.cppreference.com/w/cpp/string/basic_string/operator%22%22s

追記

そんなことはなかった。using namesapce std;でもつかえるのか。
http://melpon.org/wandbox/permlink/HncqwQrsUDgd6m2P

21.7 Suffix for basic_string literals [basic.string.literals]
string operator "" s(const char* str, size_t len);
1 Returns: string{str,len}
u16string operator "" s(const char16_t* str, size_t len);
2 Returns: u16string{str,len}
u32string operator "" s(const char32_t* str, size_t len);
3 Returns: u32string{str,len}
wstring operator "" s(const wchar_t* str, size_t len);
4 Returns: wstring{str,len}
5 [ Note: The same suffix s is used for chrono::duration literals denoting seconds but there is no conflict,
since duration suffixes apply to numbers and string literal suffixes apply to character array literals. —end
note ]

規格書にはこれしか書いてないけど

http://en.cppreference.com/w/cpp/string/basic_string/operator%22%22s
Access to these operators can be gained with using namespace std::literals, using namespace std::string_literals, and using namespace std::literals::string_literals.

この一文はどこから出てきたんだろう

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant