bool insert_to_uset(const char* key, UnorderedSet &uset_object)
{
    Expensive *pobject = new Expensive(key);
    bool success = uset_object.insert(*pobject).second;
    if(!success)   delete pobject;
    return success;
}
	SPtr<EditorWidgetLayout> EditorWidgetManager::getLayout() const
	{
		auto GetWidgetNamesInContainer = [&] (const EditorWidgetContainer* container)
		{
			Vector<String> widgetNames;
			if(container != nullptr)
			{
				UINT32 numWidgets = container->getNumWidgets();

				for(UINT32 i = 0; i < numWidgets; i++)
				{
					EditorWidgetBase* widget = container->getWidget(i);
					widgetNames.push_back(widget->getName());
				}				
			}

			return widgetNames;
		};

		MainEditorWindow* mainWindow = EditorWindowManager::instance().getMainWindow();
		DockManager& dockManager = mainWindow->getDockManager();
		SPtr<EditorWidgetLayout> layout = bs_shared_ptr_new<EditorWidgetLayout>(dockManager.getLayout());

		Vector<EditorWidgetLayout::Entry>& layoutEntries = layout->getEntries();
		UnorderedSet<EditorWidgetContainer*> widgetContainers;

		for(auto& widget : mActiveWidgets)
		{
			widgetContainers.insert(widget.second->_getParent());
		}

		for(auto& widgetContainer : widgetContainers)
		{
			if(widgetContainer == nullptr)
				continue;

			layoutEntries.push_back(EditorWidgetLayout::Entry());
			EditorWidgetLayout::Entry& entry = layoutEntries.back();

			entry.widgetNames = GetWidgetNamesInContainer(widgetContainer);

			EditorWindowBase* parentWindow = widgetContainer->getParentWindow();
			entry.isDocked = parentWindow->isMain(); // Assumed widget is docked if part of main window
			
			if(!entry.isDocked)
			{
				entry.x = parentWindow->getLeft();
				entry.y = parentWindow->getTop();
				entry.width = parentWindow->getWidth();
				entry.height = parentWindow->getHeight();
			}
		}

		layout->setIsMainWindowMaximized(mainWindow->getRenderWindow()->getProperties().isMaximized());

		return layout;
	}
示例#3
0
int main(int argc, char* argv[])
{
    // vector<int> myvec {3, 1, 32, 12, 35, 12, 2, 8};
    // pq_sort(myvec);
    
    // for(auto it = myvec.begin(); it != myvec.end(); ++it)
    // {
    //     cout << *it << ' ';
    // }
    
    // cout << endl;
    
    if(argc != 2)
    {
        cout <<"Error: " << endl;
        exit(-1);
    }
    
    else
    {
        ifstream inFS;
        inFS.open(argv[1]);
        vector<string> v;
        string s;
        UnorderedSet uS;
        
        if(inFS.is_open())
        {
            while(inFS >> s)
            {
                v.push_back(s);
            }
        }
        
        for(string& x: v)
        {
            uS.insert(x);
        }
        
        uS.print();
    }
    
    
    return 0;
}