& ~ResourceLoadFlag::KeepInternalRef cannot compile


#1

Hello,
I am reading and trying the loading part of user manual: http://docs.bsframework.io/latest/resource_saving_and_loading.html
Seems the demo code:
HMesh mesh = gResources().load(“myTexture.asset”, ResourceLoadFlag::Default & ~ResourceLoadFlag::KeepInternalRef);
cannot compile, the below is the output:
[ 50%] Building CXX object CMakeFiles/myApp.dir/Main.cpp.o
/Users/yingjun/engage/bsfworks/Main.cpp:18:81: error: invalid operands to binary
expression (‘bs::ResourceLoadFlag’ and ‘Flags<bs::ResourceLoadFlag, bs::UINT32>’
(aka ‘Flags<bs::ResourceLoadFlag, unsigned int>’))
…ResourceLoadFlag::Default & ~ResourceLoadFlag::KeepInternalRef);
~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/yingjun/engage/bsf/include/bsfUtility/Utility/BsFlags.h:224:31: note: candidate
function not viable: expects an l-value for 2nd argument
friend Flags<Enum, Storage> operator&(Enum a, Flags<Enum, Storage> &b)
^
/Users/yingjun/engage/bsf/include/bsfCore/Resources/BsResources.h:40:2: note: candidate
function not viable: no known conversion from ‘Flags<bs::ResourceLoadFlag,
bs::UINT32>’ (aka ‘Flags<bs::ResourceLoadFlag, unsigned int>’) to
‘bs::ResourceLoadFlag’ for 2nd argument
BS_FLAGS_OPERATORS(ResourceLoadFlag);

Do I miss some header files?


#2

Try using ResourceLoadFlags(ResourceLoadFlag::Default) & ~ResourceLoadFlag::KeepInternalRef for the second argument.


#3

It works. Thanks for the help.