i’m disabling using namespace juce in a project (i’m using xcode + juce off of develop). i’ve noticed that in some places literal operators (_px and _fr) stopped working. xcode gives me:
No matching literal operator for call to 'operator""_fr' with argument of type 'unsigned long long' or 'const char *', and no matching literal operator template
example 1
i had some standard code that looks like this:
void FooComponent::resized() {
Grid grid;
using Track = Grid::TrackInfo;
grid.templateRows = {
Track(1_fr),
};
this obviously need to be fixed. i tried this:
void FooComponent::resized() {
juce::Grid grid;
using Track = juce::Grid::TrackInfo;
grid.templateRows = {
Track(1_fr),
};
and it didn’t work. the only way i could get this working is to locally pull the juce namespace back in
:
void FooComponent::resized() {
using namespace juce;
Grid grid;
using Track = Grid::TrackInfo;
grid.templateRows = {
Track(1_fr),
};
example 2
// in a header file
class CustomLookAndFeel : public LookAndFeel_V4 {
public:
static constexpr const Grid::Px rowGap{5.0f};
}
this code also stopped working. this didn’t work:
class CustomLookAndFee : public juce::LookAndFeel_V4l {
public:
static constexpr const juce::Grid::Px rowGap{5.0f};
}
in the end i fixed this one by initializing the variable in the .cpp file, ie:
// CustomLookAndFeel.h
class CustomLookAndFeel : public juce::LookAndFeel_V4 {
static const juce::Grid::Px rowGap;
}
// CustomLookAndFeel.cpp
const juce::Grid::Px CustomLookAndFeel::rowGap = 5_px;
any ideas here? is this a juce bug or user error?
