Setting values inside a tuple of vectors in a Singleton with std::get

I am creating a tuple of vectors of various objects – and it is a singleton. I have nested this singleton class within another class.
Right now I have no idea what the issue is, but I am unable to revise and set values to member variables of the objects in the vectors of that singleton tuple (that is a mouthful!). Basically, I think I am struggling with the syntax, and it is due to my lack of experience. I have searched for someone else doing this, but unable to grasp what might be taking place.

The crux of the issue is with size_t addDevice(); below:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>#include <string>
#include <vector>
#include <tuple>
#define TOTAL 100
typedef std::tuple<
std::vector<X>,
std::vector<Y>,
std::vector<Z>
> SingletonTuple;
class Device
{
public:
Device() { activeStatus = false; };
private:
bool activeStatus;
};
class Controller
{
public:
Controller() { };
size_t addDevice();
class Singleton
{
public:
static Singleton& Instance()
{
static Singleton singleton(TOTAL);
return singleton;
}
private:
friend class Controller;
size_t numDevices;
SingletoneTuple singletonTuple;
Singleton(size_t total);
};
};
Controller::Singleton::Singleton(size_t total)
{
numDevices = total;
Singleton::singleton = std::make_tuple(std::vector<X>(total), std::vector<Y>(total), std::vector<Z>(total));
}
size_t Controller::addDevice()
{
index = computeIndex(); //defined elsewhere but assume it returns an index
std::get<std::vector<X>>(singleton)[index].activeStatus = true;
std::get<std::vector<Y>>(singleton)[index].activeStatus = true;
std::get<std::vector<Z>>(singleton)[index].activeStatus = true;
return index;
}
</code>
<code>#include <string> #include <vector> #include <tuple> #define TOTAL 100 typedef std::tuple< std::vector<X>, std::vector<Y>, std::vector<Z> > SingletonTuple; class Device { public: Device() { activeStatus = false; }; private: bool activeStatus; }; class Controller { public: Controller() { }; size_t addDevice(); class Singleton { public: static Singleton& Instance() { static Singleton singleton(TOTAL); return singleton; } private: friend class Controller; size_t numDevices; SingletoneTuple singletonTuple; Singleton(size_t total); }; }; Controller::Singleton::Singleton(size_t total) { numDevices = total; Singleton::singleton = std::make_tuple(std::vector<X>(total), std::vector<Y>(total), std::vector<Z>(total)); } size_t Controller::addDevice() { index = computeIndex(); //defined elsewhere but assume it returns an index std::get<std::vector<X>>(singleton)[index].activeStatus = true; std::get<std::vector<Y>>(singleton)[index].activeStatus = true; std::get<std::vector<Z>>(singleton)[index].activeStatus = true; return index; } </code>
#include <string>
#include <vector>
#include <tuple>

#define TOTAL 100

typedef std::tuple<
    std::vector<X>,
    std::vector<Y>,
    std::vector<Z>
> SingletonTuple;

class Device
{
public:
   Device() { activeStatus = false; };
private:
   bool activeStatus;
};

class Controller
{    
public:
    Controller() {  };
    size_t addDevice();
    class Singleton
    {
    public:
        static Singleton& Instance()
        {
            static Singleton singleton(TOTAL);
            return singleton;
        }
    private:
        friend class Controller;
        size_t numDevices;
        SingletoneTuple singletonTuple;
        Singleton(size_t total);
    };
};

Controller::Singleton::Singleton(size_t total)
{
    numDevices = total;
    Singleton::singleton = std::make_tuple(std::vector<X>(total), std::vector<Y>(total), std::vector<Z>(total));
}

size_t Controller::addDevice()
{
    index = computeIndex(); //defined elsewhere but assume it returns an index
    std::get<std::vector<X>>(singleton)[index].activeStatus = true;
    std::get<std::vector<Y>>(singleton)[index].activeStatus = true;
    std::get<std::vector<Z>>(singleton)[index].activeStatus = true;
    return index;
}

These from above show up as an invalid function regarding std::get:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> std::get<std::vector<X>>(singleton)[index].activeStatus = true;
std::get<std::vector<Y>>(singleton)[index].activeStatus = true;
std::get<std::vector<Z>>(singleton)[index].activeStatus = true;
</code>
<code> std::get<std::vector<X>>(singleton)[index].activeStatus = true; std::get<std::vector<Y>>(singleton)[index].activeStatus = true; std::get<std::vector<Z>>(singleton)[index].activeStatus = true; </code>
    std::get<std::vector<X>>(singleton)[index].activeStatus = true;
    std::get<std::vector<Y>>(singleton)[index].activeStatus = true;
    std::get<std::vector<Z>>(singleton)[index].activeStatus = true;

Does anybody know how I should revise the syntax of the above 3 items in regards to having a nested singleton and trying to reference member variables inside objects inside vectors inside a singleton tuple?

I have searched for solutions but it seems nobody is trying this particular approach.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật