Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8731745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:18:25+00:00 2026-06-13T09:18:25+00:00

In my base framework I like to have classes that I can reuse in

  • 0

In my base framework I like to have classes that I can reuse in several projects. Most often these are generic to allow for flexibility.

I have one tiny little header that I use to store data in and get the data easily.

#pragma once
#include <map>
#include <string>

namespace BaseFrameWork
{
template<class TValue, class TKey = std::string>
class Provider
{
public:
  static TValue& Get(TKey const& key);
private:
  static std::map<TKey, TValue> _dataMap;
};
}  

Yeah it’s just a wrapper for a map, but I like it as sort of a central place to get Data from.
I can do Provider<Room>::Get("U-18") for example and get the object that was loaded inside from who cares where from.

I acknowledge how frowned upon it is to have global objects like this, but this is not part of a public API and only used in personal projects where the team is ok with using it.

What I want to know is if there is a name for this pattern, if it even is one. I always called it Provider-Pattern since thats what it does, provide stuff, but I saw that thats already taken.

And please refrain from telling just how bad this code is and how I should feel bad for it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:18:26+00:00Added an answer on June 13, 2026 at 9:18 am

    It’s a Singleton pattern, with the data item being a map (effectively an opaque associative container when access is through a getter and presumably setter). An associative container isn’t generally considered a design pattern in and of itself.

    If you’re looking for a phrase that communicates this design succinctly and clearly, something like a “Singleton map initialised (when/how) and read-only thereafter”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these classes in C# (.NET Framework 3.5) described below: public class Base
I've implemented an undo /redo framework and have a set of command classes that
I am contemplating designing a framework to allow for one C++ code base to
I know that an MVC framework allows you to separate business logic, data base
I have a c++ class derived from a base class in a framework. The
I have a set of classes that I've written in C++ for a code
I have a service layer that I would like to convert into a webservice.
I have a class that inherits a base class to which another class has
I have the following classes in Entity Framework 4.1 (the classes have been pruned
With a simple model like that class Model < ActiveRecord::Base # ... end we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.