<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" >

  <channel>
    <title><![CDATA[Комментарии / Профиль codeoneclick]]></title>
    <link>https://habr.com/ru/users/codeoneclick/comments/</link>
    <description><![CDATA[Хабр: комментарии пользователя codeoneclick]]></description>
    <language>ru</language>
    <managingEditor>editor@habr.com</managingEditor>
    <generator>habr.com</generator>
    <pubDate>Tue, 21 Jul 2026 13:56:29 GMT</pubDate>
    
    
      <image>
        <link>https://habr.com/ru/</link>
        <url>https://habrastorage.org/webt/ym/el/wk/ymelwk3zy1gawz4nkejl_-ammtc.png</url>
        <title>Хабр</title>
      </image>
    

    
      

      
        
  
    <item>
      <title>30.06.2013 19:09:31 </title>
      <guid isPermaLink="true">https://habr.com/ru/companies/infopulse/articles/185144/#comment_6438866</guid>
      <link>https://habr.com/ru/companies/infopulse/articles/185144/#comment_6438866</link>
      <description><![CDATA[Отличная статья! Подобраны, довольно часто встречающиеся, и жизненые примеры «плохого кода». Сам давно стараюсь пользоваться принципами «программирования от абстракции», а не «от реализации».]]></description>
      <pubDate>Sun, 30 Jun 2013 19:09:31 GMT</pubDate>
      <dc:creator><![CDATA[]]></dc:creator>
    </item>
  

  
    <item>
      <title>26.06.2013 14:58:33 </title>
      <guid isPermaLink="true">https://habr.com/ru/articles/184562/#comment_6424692</guid>
      <link>https://habr.com/ru/articles/184562/#comment_6424692</link>
      <description><![CDATA[Довольно интерессное предложение. Но насколько я понял, избежать работы с variadic templates не получится. Возможно я что-то не так понял, но вот по быстрому набросал реализацию:<br/>
<br/>
<pre><code class="cpp">std::queue&lt;std::packaged_task&lt;void()&gt;&gt; queue;

template&lt;class FUNCTION, class ...ARGS&gt;
std::future&lt;typename std::result_of&lt;FUNCTION(ARGS...)&gt;::type&gt;
dispatch(FUNCTION &&f, ARGS &&...args) {
    std::packaged_task&lt;typename std::result_of&lt;FUNCTION(ARGS...)&gt;::type()&gt; task(std::bind(f,args...));
    auto future = task.get_future();
    queue.push(std::packaged_task&lt;void()&gt;(std::move(task)));
    return future;
}

std::function&lt;void(int, float, std::string)&gt; function = [](int a, float b, const std::string& c)
{
      EXPECT_TRUE(a == 1 && b == 2.0f && c == &quot;Hello World&quot;);
};
    
auto future = dispatch(std::move(function), 1, 2.0f, &quot;Hello World&quot;);
queue.back()();
</code></pre><br/>
<br/>
Поправьте меня, если я не прав :-)<br/>
]]></description>
      <pubDate>Wed, 26 Jun 2013 14:58:33 GMT</pubDate>
      <dc:creator><![CDATA[]]></dc:creator>
    </item>
  

  
    <item>
      <title>26.06.2013 14:37:35 </title>
      <guid isPermaLink="true">https://habr.com/ru/articles/184562/#comment_6424576</guid>
      <link>https://habr.com/ru/articles/184562/#comment_6424576</link>
      <description><![CDATA[Если повнимательней присмотреться, то можно понять, что предложенный вами вариант будет работать без каких либо изменений.<br/>
<br/>
<pre><code class="cpp">class Clazz
{
    
public:
    
    std::string m_value;
    
    void Foo(int a, float b, const std::string& c)
    {
        std::cout&lt;&lt;a&lt;&lt;b&lt;&lt;c&lt;&lt;std::endl;
    };
};

typedef std::function&lt;void(void)&gt; task_t;

TEST(gcdppLib, Dispatch_05)
{
    std::shared_ptr&lt;Clazz&gt; clazz = std::make_shared&lt;Clazz&gt;();
    task_t task = std::bind(&Clazz::Foo, clazz, 1, 2.0f, &quot;Hello World&quot;);
    gcdpp::gcdpp_dispatch_async(gcdpp::gcdpp_dispatch_get_global_queue(gcdpp::GCDPP_DISPATCH_QUEUE_PRIORITY_HIGH), task);
}

</code></pre><br/>
Но все равно спасибо за замечание, так как без вас вряд бы проверил такой вариант. ;-)]]></description>
      <pubDate>Wed, 26 Jun 2013 14:37:35 GMT</pubDate>
      <dc:creator><![CDATA[]]></dc:creator>
    </item>
  

      

      

    
  </channel>
</rss>
