{"action":"created","comment":{"url":"https://api.github.com/repos/root-mirror/root/pulls/comments/72915105","id":72915105,"diff_hunk":"@@ -26,77 +26,70 @@ namespace Experimental {\n \n namespace Internal {\n \n-/**\n-  Abstract base for a `TDirectory` element.\n- */\n-class TDirectoryEntryPtrBase {\n+class TDirectoryEntry {\n public:\n-  virtual ~TDirectoryEntryPtrBase() {}\n   using clock_t = std::chrono::system_clock;\n   using time_point_t = std::chrono::time_point<clock_t>;\n \n-private:\n-  time_point_t fDate = clock_t::now(); ///< Time of last change\n-  TClass* fType = 0; ///< The type of the object\n-\n-protected:\n-  TDirectoryEntryPtrBase() = default;\n-\n public:\n-  /// Constructor setting the type.\n-  TDirectoryEntryPtrBase(TClass* cl): fType(cl) {}\n+  TDirectoryEntry(): TDirectoryEntry(nullptr) {}\n+  TDirectoryEntry(std::nullptr_t):\n+    TDirectoryEntry(std::make_shared<std::nullptr_t>(nullptr)) {}\n+  template<class T>\n+  explicit TDirectoryEntry(T* ptr):\n+    TDirectoryEntry(std::make_shared<T>(*ptr)) {}\n+  template<class T>\n+  explicit TDirectoryEntry(const std::shared_ptr<T>& ptr):\n+    fTypeInfo(&typeid(T)),\n+    fType(TClass::GetClass(typeid(T))),\n+    fObj(ptr) {}\n \n   /// Get the last change date of the entry.\n   const time_point_t& GetDate() const { return fDate; }\n \n-  /// Get the object's type.\n-  TClass* GetType() const { return fType; }\n-\n   /// Inform the entry that it has been modified, and needs to update its\n   /// last-changed time stamp.\n   void SetChanged() { fDate = clock_t::now(); }\n \n-  /// Abstract interface to retrieve the address of the object represented by\n-  /// this entry, if any.\n-  virtual void* GetObjectAddr() const = 0;\n-\n-  /// Abstract interface to retrieve the type of the object represented by this\n-  /// entry.\n-  virtual const std::type_info& GetTypeInfo() const = 0;\n-};\n-\n-\n-/**\n- Type-aware part of an entry in a TDirectory. It can manage the lifetime of an\n- object, or only inform about last-change date and the type of an object.\n- */\n-\n-template <class T>\n-class TDirectoryEntryPtr: public TDirectoryEntryPtrBase {\n-public:\n-  /// Initialize a TDirectoryEntryPtr from an existing object (\"write\").\n-  TDirectoryEntryPtr(T&& obj):\n-    TDirectoryEntryPtrBase(TClass::GetClass(typeid(T))),  fObj(obj) {}\n-\n-  /// Initialize a TDirectoryEntryPtr from an existing object (\"write\").\n-  TDirectoryEntryPtr(const std::shared_ptr<T>& ptr): fObj(ptr) {}\n+  /// Type of the object represented by this entry.\n+  const std::type_info& GetTypeInfo() const { return *fTypeInfo; }\n \n-  virtual ~TDirectoryEntryPtr() {}\n+  /// Get the object's type.\n+  TClass* GetType() const { return fType; }\n \n   /// Retrieve the `shared_ptr` of the referenced object.\n-  std::shared_ptr<T>& GetPointer() const { return fObj; }\n+  std::shared_ptr<void>& GetPointer() { return fObj; }\n+  const std::shared_ptr<void>& GetPointer() const { return fObj; }\n \n-  /// Retrieve the address of the object managed by this entry.\n-  /// Returns `nullptr` if no object is managed by this entry.\n-  void* GetObjectAddr() const final { return fObj.get(); }\n+  template<class U>\n+  std::shared_ptr<U> CastPointer() const;\n \n-  /// Type of the object represented by this entry.\n-  const std::type_info& GetTypeInfo() const final { return typeid(T); }\n+  explicit operator bool() const { return *fTypeInfo != typeid(std::nullptr_t); }\n \n private:\n-  std::shared_ptr<T> fObj; ///< Object referenced by this entry, if any.\n+  time_point_t fDate = clock_t::now(); ///< Time of last change","path":"core/base/v7/inc/ROOT/TDirectoryEntry.h","position":null,"original_position":94,"commit_id":"8eabb83cc5018a61708398641c5d6ac19f6dd53f","original_commit_id":"8603748a04582eaab521dde3244cff4a54ea8e13","user":{"login":"pcanal","id":5175087,"avatar_url":"https://avatars.githubusercontent.com/u/5175087?v=3","gravatar_id":"","url":"https://api.github.com/users/pcanal","html_url":"https://github.com/pcanal","followers_url":"https://api.github.com/users/pcanal/followers","following_url":"https://api.github.com/users/pcanal/following{/other_user}","gists_url":"https://api.github.com/users/pcanal/gists{/gist_id}","starred_url":"https://api.github.com/users/pcanal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcanal/subscriptions","organizations_url":"https://api.github.com/users/pcanal/orgs","repos_url":"https://api.github.com/users/pcanal/repos","events_url":"https://api.github.com/users/pcanal/events{/privacy}","received_events_url":"https://api.github.com/users/pcanal/received_events","type":"User","site_admin":false},"body":"I am not sure what you are referring to.  We have many developers, each using their own development tools and their favorite editors.   In addition, most of them are working on different projects (which usually have different favorite indentation size).   This results in each having a different setting for the 'number of spaces' the editor replaces tab with ... resulting in misaligned code.\r\n\r\nIf something has happened that relief this situation and make the tab be replaced by the correct number of spaces no matter what, I am not aware of it. (In addition, I am not aware on any advantages of using tab characters).\r\n\r\nAs a side note I can send you a work-in-progress .clang-format that is close to what is needed (but not quite, in part due to quirk in clang-format).\r\n\r\nthanks.","created_at":"2016-08-01T00:58:22Z","updated_at":"2016-08-01T00:58:22Z","html_url":"https://github.com/root-mirror/root/pull/205#discussion_r72915105","pull_request_url":"https://api.github.com/repos/root-mirror/root/pulls/205","_links":{"self":{"href":"https://api.github.com/repos/root-mirror/root/pulls/comments/72915105"},"html":{"href":"https://github.com/root-mirror/root/pull/205#discussion_r72915105"},"pull_request":{"href":"https://api.github.com/repos/root-mirror/root/pulls/205"}}},"pull_request":{"url":"https://api.github.com/repos/root-mirror/root/pulls/205","id":78585787,"html_url":"https://github.com/root-mirror/root/pull/205","diff_url":"https://github.com/root-mirror/root/pull/205.diff","patch_url":"https://github.com/root-mirror/root/pull/205.patch","issue_url":"https://api.github.com/repos/root-mirror/root/issues/205","number":205,"state":"closed","locked":false,"title":"Rewrite ROOT::Experimental::TDirectory[Entry].h, add cast to base class","user":{"login":"BerserkerTroll","id":20418480,"avatar_url":"https://avatars.githubusercontent.com/u/20418480?v=3","gravatar_id":"","url":"https://api.github.com/users/BerserkerTroll","html_url":"https://github.com/BerserkerTroll","followers_url":"https://api.github.com/users/BerserkerTroll/followers","following_url":"https://api.github.com/users/BerserkerTroll/following{/other_user}","gists_url":"https://api.github.com/users/BerserkerTroll/gists{/gist_id}","starred_url":"https://api.github.com/users/BerserkerTroll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BerserkerTroll/subscriptions","organizations_url":"https://api.github.com/users/BerserkerTroll/orgs","repos_url":"https://api.github.com/users/BerserkerTroll/repos","events_url":"https://api.github.com/users/BerserkerTroll/events{/privacy}","received_events_url":"https://api.github.com/users/BerserkerTroll/received_events","type":"User","site_admin":false},"body":"Based on `TClass::DynamicCast()`.\r\n`root` script to check it working https://gist.github.com/BerserkerTroll/b94c2d3e3a5848be7c7dd53e323e1cdb\r\n\r\nBesides different cast method, some bugs were fixed, so #200 was actually broken, despite it compiles (nobody has instantiated broken templates). Consider @a885623b7f04d193b299097b189bbb1fd45139e1 (exception-based cast, without bugs) if you want to get rid of `TClass` or apply this https://gist.github.com/BerserkerTroll/b6624c5f74b71293bc9c2059b4e5236a patch to this PR.","created_at":"2016-07-24T00:03:37Z","updated_at":"2016-08-01T00:58:22Z","closed_at":"2016-07-29T16:55:34Z","merged_at":null,"merge_commit_sha":"cf8d8e2aff052b2fb3a7105656851482260a0316","assignee":{"login":"karies","id":144675,"avatar_url":"https://avatars.githubusercontent.com/u/144675?v=3","gravatar_id":"","url":"https://api.github.com/users/karies","html_url":"https://github.com/karies","followers_url":"https://api.github.com/users/karies/followers","following_url":"https://api.github.com/users/karies/following{/other_user}","gists_url":"https://api.github.com/users/karies/gists{/gist_id}","starred_url":"https://api.github.com/users/karies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karies/subscriptions","organizations_url":"https://api.github.com/users/karies/orgs","repos_url":"https://api.github.com/users/karies/repos","events_url":"https://api.github.com/users/karies/events{/privacy}","received_events_url":"https://api.github.com/users/karies/received_events","type":"User","site_admin":false},"assignees":[{"login":"karies","id":144675,"avatar_url":"https://avatars.githubusercontent.com/u/144675?v=3","gravatar_id":"","url":"https://api.github.com/users/karies","html_url":"https://github.com/karies","followers_url":"https://api.github.com/users/karies/followers","following_url":"https://api.github.com/users/karies/following{/other_user}","gists_url":"https://api.github.com/users/karies/gists{/gist_id}","starred_url":"https://api.github.com/users/karies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karies/subscriptions","organizations_url":"https://api.github.com/users/karies/orgs","repos_url":"https://api.github.com/users/karies/repos","events_url":"https://api.github.com/users/karies/events{/privacy}","received_events_url":"https://api.github.com/users/karies/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/root-mirror/root/pulls/205/commits","review_comments_url":"https://api.github.com/repos/root-mirror/root/pulls/205/comments","review_comment_url":"https://api.github.com/repos/root-mirror/root/pulls/comments{/number}","comments_url":"https://api.github.com/repos/root-mirror/root/issues/205/comments","statuses_url":"https://api.github.com/repos/root-mirror/root/statuses/8eabb83cc5018a61708398641c5d6ac19f6dd53f","head":{"label":"BerserkerTroll:tdirectoryupcast_nothrow","ref":"tdirectoryupcast_nothrow","sha":"8eabb83cc5018a61708398641c5d6ac19f6dd53f","user":{"login":"BerserkerTroll","id":20418480,"avatar_url":"https://avatars.githubusercontent.com/u/20418480?v=3","gravatar_id":"","url":"https://api.github.com/users/BerserkerTroll","html_url":"https://github.com/BerserkerTroll","followers_url":"https://api.github.com/users/BerserkerTroll/followers","following_url":"https://api.github.com/users/BerserkerTroll/following{/other_user}","gists_url":"https://api.github.com/users/BerserkerTroll/gists{/gist_id}","starred_url":"https://api.github.com/users/BerserkerTroll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BerserkerTroll/subscriptions","organizations_url":"https://api.github.com/users/BerserkerTroll/orgs","repos_url":"https://api.github.com/users/BerserkerTroll/repos","events_url":"https://api.github.com/users/BerserkerTroll/events{/privacy}","received_events_url":"https://api.github.com/users/BerserkerTroll/received_events","type":"User","site_admin":false},"repo":{"id":63151361,"name":"root","full_name":"BerserkerTroll/root","owner":{"login":"BerserkerTroll","id":20418480,"avatar_url":"https://avatars.githubusercontent.com/u/20418480?v=3","gravatar_id":"","url":"https://api.github.com/users/BerserkerTroll","html_url":"https://github.com/BerserkerTroll","followers_url":"https://api.github.com/users/BerserkerTroll/followers","following_url":"https://api.github.com/users/BerserkerTroll/following{/other_user}","gists_url":"https://api.github.com/users/BerserkerTroll/gists{/gist_id}","starred_url":"https://api.github.com/users/BerserkerTroll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BerserkerTroll/subscriptions","organizations_url":"https://api.github.com/users/BerserkerTroll/orgs","repos_url":"https://api.github.com/users/BerserkerTroll/repos","events_url":"https://api.github.com/users/BerserkerTroll/events{/privacy}","received_events_url":"https://api.github.com/users/BerserkerTroll/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BerserkerTroll/root","description":"Mirror of official ROOT git repository","fork":true,"url":"https://api.github.com/repos/BerserkerTroll/root","forks_url":"https://api.github.com/repos/BerserkerTroll/root/forks","keys_url":"https://api.github.com/repos/BerserkerTroll/root/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BerserkerTroll/root/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BerserkerTroll/root/teams","hooks_url":"https://api.github.com/repos/BerserkerTroll/root/hooks","issue_events_url":"https://api.github.com/repos/BerserkerTroll/root/issues/events{/number}","events_url":"https://api.github.com/repos/BerserkerTroll/root/events","assignees_url":"https://api.github.com/repos/BerserkerTroll/root/assignees{/user}","branches_url":"https://api.github.com/repos/BerserkerTroll/root/branches{/branch}","tags_url":"https://api.github.com/repos/BerserkerTroll/root/tags","blobs_url":"https://api.github.com/repos/BerserkerTroll/root/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BerserkerTroll/root/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BerserkerTroll/root/git/refs{/sha}","trees_url":"https://api.github.com/repos/BerserkerTroll/root/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BerserkerTroll/root/statuses/{sha}","languages_url":"https://api.github.com/repos/BerserkerTroll/root/languages","stargazers_url":"https://api.github.com/repos/BerserkerTroll/root/stargazers","contributors_url":"https://api.github.com/repos/BerserkerTroll/root/contributors","subscribers_url":"https://api.github.com/repos/BerserkerTroll/root/subscribers","subscription_url":"https://api.github.com/repos/BerserkerTroll/root/subscription","commits_url":"https://api.github.com/repos/BerserkerTroll/root/commits{/sha}","git_commits_url":"https://api.github.com/repos/BerserkerTroll/root/git/commits{/sha}","comments_url":"https://api.github.com/repos/BerserkerTroll/root/comments{/number}","issue_comment_url":"https://api.github.com/repos/BerserkerTroll/root/issues/comments{/number}","contents_url":"https://api.github.com/repos/BerserkerTroll/root/contents/{+path}","compare_url":"https://api.github.com/repos/BerserkerTroll/root/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BerserkerTroll/root/merges","archive_url":"https://api.github.com/repos/BerserkerTroll/root/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BerserkerTroll/root/downloads","issues_url":"https://api.github.com/repos/BerserkerTroll/root/issues{/number}","pulls_url":"https://api.github.com/repos/BerserkerTroll/root/pulls{/number}","milestones_url":"https://api.github.com/repos/BerserkerTroll/root/milestones{/number}","notifications_url":"https://api.github.com/repos/BerserkerTroll/root/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BerserkerTroll/root/labels{/name}","releases_url":"https://api.github.com/repos/BerserkerTroll/root/releases{/id}","deployments_url":"https://api.github.com/repos/BerserkerTroll/root/deployments","created_at":"2016-07-12T11:08:07Z","updated_at":"2016-07-12T11:09:06Z","pushed_at":"2016-07-28T18:38:38Z","git_url":"git://github.com/BerserkerTroll/root.git","ssh_url":"git@github.com:BerserkerTroll/root.git","clone_url":"https://github.com/BerserkerTroll/root.git","svn_url":"https://github.com/BerserkerTroll/root","homepage":"http://root.cern.ch","size":584581,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"root-mirror:master","ref":"master","sha":"db6f81290c49b0f1d54a467dfb00a31b5b6bbd9b","user":{"login":"root-mirror","id":4849136,"avatar_url":"https://avatars.githubusercontent.com/u/4849136?v=3","gravatar_id":"","url":"https://api.github.com/users/root-mirror","html_url":"https://github.com/root-mirror","followers_url":"https://api.github.com/users/root-mirror/followers","following_url":"https://api.github.com/users/root-mirror/following{/other_user}","gists_url":"https://api.github.com/users/root-mirror/gists{/gist_id}","starred_url":"https://api.github.com/users/root-mirror/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/root-mirror/subscriptions","organizations_url":"https://api.github.com/users/root-mirror/orgs","repos_url":"https://api.github.com/users/root-mirror/repos","events_url":"https://api.github.com/users/root-mirror/events{/privacy}","received_events_url":"https://api.github.com/users/root-mirror/received_events","type":"Organization","site_admin":false},"repo":{"id":10994345,"name":"root","full_name":"root-mirror/root","owner":{"login":"root-mirror","id":4849136,"avatar_url":"https://avatars.githubusercontent.com/u/4849136?v=3","gravatar_id":"","url":"https://api.github.com/users/root-mirror","html_url":"https://github.com/root-mirror","followers_url":"https://api.github.com/users/root-mirror/followers","following_url":"https://api.github.com/users/root-mirror/following{/other_user}","gists_url":"https://api.github.com/users/root-mirror/gists{/gist_id}","starred_url":"https://api.github.com/users/root-mirror/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/root-mirror/subscriptions","organizations_url":"https://api.github.com/users/root-mirror/orgs","repos_url":"https://api.github.com/users/root-mirror/repos","events_url":"https://api.github.com/users/root-mirror/events{/privacy}","received_events_url":"https://api.github.com/users/root-mirror/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/root-mirror/root","description":"Mirror of official ROOT git repository","fork":false,"url":"https://api.github.com/repos/root-mirror/root","forks_url":"https://api.github.com/repos/root-mirror/root/forks","keys_url":"https://api.github.com/repos/root-mirror/root/keys{/key_id}","collaborators_url":"https://api.github.com/repos/root-mirror/root/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/root-mirror/root/teams","hooks_url":"https://api.github.com/repos/root-mirror/root/hooks","issue_events_url":"https://api.github.com/repos/root-mirror/root/issues/events{/number}","events_url":"https://api.github.com/repos/root-mirror/root/events","assignees_url":"https://api.github.com/repos/root-mirror/root/assignees{/user}","branches_url":"https://api.github.com/repos/root-mirror/root/branches{/branch}","tags_url":"https://api.github.com/repos/root-mirror/root/tags","blobs_url":"https://api.github.com/repos/root-mirror/root/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/root-mirror/root/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/root-mirror/root/git/refs{/sha}","trees_url":"https://api.github.com/repos/root-mirror/root/git/trees{/sha}","statuses_url":"https://api.github.com/repos/root-mirror/root/statuses/{sha}","languages_url":"https://api.github.com/repos/root-mirror/root/languages","stargazers_url":"https://api.github.com/repos/root-mirror/root/stargazers","contributors_url":"https://api.github.com/repos/root-mirror/root/contributors","subscribers_url":"https://api.github.com/repos/root-mirror/root/subscribers","subscription_url":"https://api.github.com/repos/root-mirror/root/subscription","commits_url":"https://api.github.com/repos/root-mirror/root/commits{/sha}","git_commits_url":"https://api.github.com/repos/root-mirror/root/git/commits{/sha}","comments_url":"https://api.github.com/repos/root-mirror/root/comments{/number}","issue_comment_url":"https://api.github.com/repos/root-mirror/root/issues/comments{/number}","contents_url":"https://api.github.com/repos/root-mirror/root/contents/{+path}","compare_url":"https://api.github.com/repos/root-mirror/root/compare/{base}...{head}","merges_url":"https://api.github.com/repos/root-mirror/root/merges","archive_url":"https://api.github.com/repos/root-mirror/root/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/root-mirror/root/downloads","issues_url":"https://api.github.com/repos/root-mirror/root/issues{/number}","pulls_url":"https://api.github.com/repos/root-mirror/root/pulls{/number}","milestones_url":"https://api.github.com/repos/root-mirror/root/milestones{/number}","notifications_url":"https://api.github.com/repos/root-mirror/root/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/root-mirror/root/labels{/name}","releases_url":"https://api.github.com/repos/root-mirror/root/releases{/id}","deployments_url":"https://api.github.com/repos/root-mirror/root/deployments","created_at":"2013-06-27T10:46:59Z","updated_at":"2016-07-28T15:42:36Z","pushed_at":"2016-07-31T19:35:47Z","git_url":"git://github.com/root-mirror/root.git","ssh_url":"git@github.com:root-mirror/root.git","clone_url":"https://github.com/root-mirror/root.git","svn_url":"https://github.com/root-mirror/root","homepage":"http://root.cern.ch","size":610981,"stargazers_count":217,"watchers_count":217,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":170,"mirror_url":null,"open_issues_count":29,"forks":170,"open_issues":29,"watchers":217,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/root-mirror/root/pulls/205"},"html":{"href":"https://github.com/root-mirror/root/pull/205"},"issue":{"href":"https://api.github.com/repos/root-mirror/root/issues/205"},"comments":{"href":"https://api.github.com/repos/root-mirror/root/issues/205/comments"},"review_comments":{"href":"https://api.github.com/repos/root-mirror/root/pulls/205/comments"},"review_comment":{"href":"https://api.github.com/repos/root-mirror/root/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/root-mirror/root/pulls/205/commits"},"statuses":{"href":"https://api.github.com/repos/root-mirror/root/statuses/8eabb83cc5018a61708398641c5d6ac19f6dd53f"}}}}
{"actor":{"display_login":"pcanal"}}