Deduce template parameter through std:is_base_of

Consider the following example: #include <memory> template<class T> class RefSP { private: std::shared_ptr<T> p; public: template<class A> RefSP(A&& v) : p(std::forward<A>(p)) {} }; template < class T, class U, typename std::enable_if<std::is_base_of<std::shared_ptr<U>, T>::value>::type* = nullptr> inline RefSP<U>* make_ref_sp(T&& p) { return new RefSP<U>(std::forward<T>(p)); } int main() { auto sp = std::make_shared<int>(42); auto x = make_ref_sp(sp); }…

Details

Not able to connect to a new MongoDB Community Edition installation

I have installed mongoDB via manual on mongodb.com. In terminal I have checked the status and the database is running: Name Status User Plist mongodb-community stopped [email protected] stopped [email protected] started vondramk /Users/vondramk/Library/LaunchAgents/[email protected] Despite this, I try to connect (again via terminal) with $ mongo and it gives me this error: connection response contain error: MongoDB…

Details

On Edit doesnt work if cell auto updates – Need a workaround Google Sheets

This code works as intended when you manually change a cell. function onEdit(event) { // assumes source data in sheet named Prepsheet // target sheet of move to named TopUp Required var ss = SpreadsheetApp.getActiveSpreadsheet(); var s = event.source.getActiveSheet(); var r = event.source.getActiveRange(); if(s.getName() == “PrepSheet” && r.getColumn() == 15 && r.getValue() == 0) {…

Details

nested drag and drop reordering

Im trying to implement nested drag and drop with help from :https://stackblitz.com/edit/angular-cdk-nested-drag-drop-demo?file=src%2Fapp%2Fhello.component.ts I could implement the nested drag and drop , but reordering doesn’t seem to work . public onDragDrop(event: CdkDragDrop<Item>) { event.container.element.nativeElement.classList.remove(“active”); if (this.canBeDropped(event)) { const movingItem: Item = event.item.data; event.container.data.children.push(movingItem); event.previousContainer.data.children = event.previousContainer.data.children.filter((child) => child.uId !== movingItem.uId); } else { moveItemInArray( event.container.data.children, event.previousIndex,…

Details