You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know this isn't the right place to ask as I don't have an issue with the library. It's more of C++ support. I have looked everywhere on Google and haven't found a solution. I hope you don't mind helping me out, I would very much appreciated it, cheers :-)
I am creating a caching class in C++ so that It can be used in iOS and Android. I have created a simple class, this class is a singleton class:
using json = nlohmann::json;
using namespace std;
class Cache
{
private:
static Cache *instance;
json j;
So far the result is what I am expecting however I am trying to implement the 'get' method. As you can see I have comment this out in the header file. I would like to implement this method so that whatever key i pass in the parameter I get the value associated with the key. For example
cache->get("test") would return string "test"
cache->get("name") returns bool true
and so on.
What I have commented out requires this syntax 'cache->get<>("key")'.
I would very much appreciate if I could get help implementing the 'get' method.
If this is not the right place to ask as this is not an issue with the framework then I will remove this thread.
Thank you for your time ;-)
The text was updated successfully, but these errors were encountered:
Morning,
I know this isn't the right place to ask as I don't have an issue with the library. It's more of C++ support. I have looked everywhere on Google and haven't found a solution. I hope you don't mind helping me out, I would very much appreciated it, cheers :-)
I am creating a caching class in C++ so that It can be used in iOS and Android. I have created a simple class, this class is a singleton class:
using json = nlohmann::json;
using namespace std;
class Cache
{
private:
static Cache *instance;
json j;
public:
static bool fileExists();
static Cache* getInstance();
// template T get(string key) { return j[key]; }
};
This is what I have implemented in Objective-C class
cache = Cache::getInstance();
So far the result is what I am expecting however I am trying to implement the 'get' method. As you can see I have comment this out in the header file. I would like to implement this method so that whatever key i pass in the parameter I get the value associated with the key. For example
cache->get("test") would return string "test"
cache->get("name") returns bool true
and so on.
What I have commented out requires this syntax 'cache->get<>("key")'.
I would very much appreciate if I could get help implementing the 'get' method.
If this is not the right place to ask as this is not an issue with the framework then I will remove this thread.
Thank you for your time ;-)
The text was updated successfully, but these errors were encountered: