Skip to content

Commit

Permalink
__cpp_user_defined_literalsにVSのIntelliSenseは対応しているが、コンパイラは対応していない
Browse files Browse the repository at this point in the history
  • Loading branch information
yumetodo committed Mar 15, 2016
1 parent c30b32b commit 3b993e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
10 changes: 0 additions & 10 deletions dxlibex/basic_types/bel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,14 @@ namespace dxle {
using namespace sound_units;
}
#ifdef DXLE_SUPPORT_CXX11_USER_DEFINED_LITERALS
#if !defined(_MSC_VER) || defined(__clang__)
namespace dxle { namespace sound_units { namespace sound_units_literals {
#else
# define myrio_bel dxle::myrio_bel
# define deci_bel dxle::deci_bel
#endif
inline DXLE_CONSTEXPR myrio_bel operator "" _myrioB(unsigned long long myrioB) {
return myrio_bel(static_cast<int>(myrioB));
}
inline DXLE_CONSTEXPR deci_bel operator "" _dB(unsigned long long myrioB) {
return deci_bel(static_cast<int>(myrioB));
}
#if !defined(_MSC_VER) || defined(__clang__)
} } }
using namespace dxle::sound_units::sound_units_literals;
#else
# undef myrio_bel
# undef deci_bel
#endif
#endif
#endif //DXLE_INC_BASIC_TYPES_BEL_HPP_
3 changes: 3 additions & 0 deletions dxlibex/config/compiler/visualc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
#ifndef __cpp_user_defined_literals
#define DXLE_NO_CXX11_USER_DEFINED_LITERALS
#endif
#if _MSC_VER == 1900
#undef DXLE_NO_CXX11_USER_DEFINED_LITERALS
#endif

#endif // #ifndef DXLE_INC_CONFIG_COMPILER_VISUALC_HPP_
2 changes: 2 additions & 0 deletions samples/sound_play/sound_play/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
#include <Windows.h>
int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nCmdShow*/) {
//SetCreateSoundPitchRate(100);
#ifdef DXLE_SUPPORT_CXX11_USER_DEFINED_LITERALS
constexpr auto rate = 300_dB;
constexpr auto rate2 = 4000_myrioB;
constexpr auto rate3 = dxle::bel_cast<dxle::bel>(rate);
#endif
constexpr dxle::deci_bel rate4(100);
}

0 comments on commit 3b993e1

Please sign in to comment.