// note: this will throw an error at initialization of s_AllUsers, // since it uses the MAX_USERS constant, which has not been // initialized yet. #include "const_val.h" #include <iostream> #include "app_props.h" const_val< long> MAX_USERS( get_props(), "max_users"); struct AllUsers { AllUsers() { std::cout << "there are max " << MAX_USERS << " users that can login." << std::endl; } }; // this should be 'dependent_static< AllUsers> s_AllUsers;' // // right now, s_AllUsers's constructor is called before main, // and will try to use MAX_USERS. However, using MAX_USERS will throw // an error, since it has not been initialized yet AllUsers s_AllUsers; int main() {} |