{"action":"created","issue":{"url":"https://api.github.com/repos/STEllAR-GROUP/hpx/issues/2062","repository_url":"https://api.github.com/repos/STEllAR-GROUP/hpx","labels_url":"https://api.github.com/repos/STEllAR-GROUP/hpx/issues/2062/labels{/name}","comments_url":"https://api.github.com/repos/STEllAR-GROUP/hpx/issues/2062/comments","events_url":"https://api.github.com/repos/STEllAR-GROUP/hpx/issues/2062/events","html_url":"https://github.com/STEllAR-GROUP/hpx/issues/2062","id":144916096,"number":2062,"title":"Support component templates","user":{"login":"HadrienG2","id":1305080,"avatar_url":"https://avatars.githubusercontent.com/u/1305080?v=3","gravatar_id":"","url":"https://api.github.com/users/HadrienG2","html_url":"https://github.com/HadrienG2","followers_url":"https://api.github.com/users/HadrienG2/followers","following_url":"https://api.github.com/users/HadrienG2/following{/other_user}","gists_url":"https://api.github.com/users/HadrienG2/gists{/gist_id}","starred_url":"https://api.github.com/users/HadrienG2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HadrienG2/subscriptions","organizations_url":"https://api.github.com/users/HadrienG2/orgs","repos_url":"https://api.github.com/users/HadrienG2/repos","events_url":"https://api.github.com/users/HadrienG2/events{/privacy}","received_events_url":"https://api.github.com/users/HadrienG2/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/STEllAR-GROUP/hpx/labels/category:%20components","name":"category: components","color":"02e10c"},{"url":"https://api.github.com/repos/STEllAR-GROUP/hpx/labels/type:%20feature%20request","name":"type: feature request","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/STEllAR-GROUP/hpx/milestones/25","html_url":"https://github.com/STEllAR-GROUP/hpx/milestones/0.9.12","labels_url":"https://api.github.com/repos/STEllAR-GROUP/hpx/milestones/25/labels","id":1380490,"number":25,"title":"0.9.12","description":"","creator":{"login":"hkaiser","id":568063,"avatar_url":"https://avatars.githubusercontent.com/u/568063?v=3","gravatar_id":"","url":"https://api.github.com/users/hkaiser","html_url":"https://github.com/hkaiser","followers_url":"https://api.github.com/users/hkaiser/followers","following_url":"https://api.github.com/users/hkaiser/following{/other_user}","gists_url":"https://api.github.com/users/hkaiser/gists{/gist_id}","starred_url":"https://api.github.com/users/hkaiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hkaiser/subscriptions","organizations_url":"https://api.github.com/users/hkaiser/orgs","repos_url":"https://api.github.com/users/hkaiser/repos","events_url":"https://api.github.com/users/hkaiser/events{/privacy}","received_events_url":"https://api.github.com/users/hkaiser/received_events","type":"User","site_admin":false},"open_issues":49,"closed_issues":199,"state":"open","created_at":"2015-10-27T22:19:24Z","updated_at":"2016-03-31T14:36:31Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-03-31T14:21:47Z","updated_at":"2016-03-31T14:43:34Z","closed_at":null,"body":"HPX components are a beautiful distributed computing abstraction. However, as far as I understand, their greatness does not currently extend to class templates. If I attempt to write a toy templated component like this...\r\n\r\n```c++\r\ntemplate<class T>\r\nclass Broadcast :\r\n   public hpx::components::simple_component_base<Broadcast<T>>\r\n{\r\n   public:\r\n      void set(const T & new_value) { m_value = new_value; }\r\n\r\n      T get() const { return m_value; }\r\n      HPX_DEFINE_COMPONENT_ACTION(Broadcast, get, get_action);\r\n\r\n   private:\r\n      T m_value;\r\n}\r\n```\r\n\r\n...then I will be unable to proceed further with the HPX_REGISTER_ACTION_DECLARATION, HPX_REGISTER_COMPONENT and HPX_REGISTER_ACTION macros, because C++ templates and C-style preprocessor macros and unique identifiers do not mix well at all.\r\n\r\nIn some cases, it is possible to work around this issue by using dynamic polymorphism instead of static polymorphism, i.e. using an abstract base class instead of a template type parameter. However, considering the very widespread use of class templates in idiomatic C++ programs, I think this is a use case that HPX might want to support in the long run.\r\n\r\nMay be somewhat related to #449, although that issue focuses more on the genericity of actions rather than that of components."},"comment":{"url":"https://api.github.com/repos/STEllAR-GROUP/hpx/issues/comments/203970154","html_url":"https://github.com/STEllAR-GROUP/hpx/issues/2062#issuecomment-203970154","issue_url":"https://api.github.com/repos/STEllAR-GROUP/hpx/issues/2062","id":203970154,"user":{"login":"HadrienG2","id":1305080,"avatar_url":"https://avatars.githubusercontent.com/u/1305080?v=3","gravatar_id":"","url":"https://api.github.com/users/HadrienG2","html_url":"https://github.com/HadrienG2","followers_url":"https://api.github.com/users/HadrienG2/followers","following_url":"https://api.github.com/users/HadrienG2/following{/other_user}","gists_url":"https://api.github.com/users/HadrienG2/gists{/gist_id}","starred_url":"https://api.github.com/users/HadrienG2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HadrienG2/subscriptions","organizations_url":"https://api.github.com/users/HadrienG2/orgs","repos_url":"https://api.github.com/users/HadrienG2/repos","events_url":"https://api.github.com/users/HadrienG2/events{/privacy}","received_events_url":"https://api.github.com/users/HadrienG2/received_events","type":"User","site_admin":false},"created_at":"2016-03-31T14:43:34Z","updated_at":"2016-03-31T14:43:34Z","body":"Ah, interesting! Just out of curiosity, do relevant macros already exist for this use case, hidden somewhere in the codebase, or does it entail diving into the internals of HPX and doing a lot of things by hand ?"}}