MESSAGE
DATE | 2016-11-22 |
FROM | ruben safir
|
SUBJECT | Subject: [Learn] declare a func or call an object
|
From learn-bounces-at-nylxs.com Wed Nov 23 01:17:28 2016 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: from www.mrbrklyn.com (www.mrbrklyn.com [96.57.23.82]) by mrbrklyn.com (Postfix) with ESMTP id 7B84A161314; Wed, 23 Nov 2016 01:17:28 -0500 (EST) X-Original-To: learn-at-nylxs.com Delivered-To: learn-at-nylxs.com Received: from mail-qt0-f169.google.com (mail-qt0-f169.google.com [209.85.216.169]) by mrbrklyn.com (Postfix) with ESMTP id D1A81161313 for ; Tue, 22 Nov 2016 21:02:59 -0500 (EST) Received: by mail-qt0-f169.google.com with SMTP id w33so25170199qtc.3 for ; Tue, 22 Nov 2016 18:02:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=my.liu.edu; s=google; h=from:newsgroups:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=FzTbjPNZBhNj9eqbaEcnQEnMGSCRzjFq1kc1fMY6aZc=; b=g8ZxE1Rygs1NQgzpSbVjEMQJmopDYlpoBXH7eWk2UnZA6qZbxBjUdEV8bCAsS/EEAE /ZCyzymxbhkoTKYWolCbCjotv3+zOl392urSOqDlNhm+xXqaLgijGPXcnIb632hfwN46 qZQlQnqsdMGEqpXIL2QvzvxG70dfwkuidA8bQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:newsgroups:subject:message-id:date :user-agent:mime-version:content-transfer-encoding; bh=FzTbjPNZBhNj9eqbaEcnQEnMGSCRzjFq1kc1fMY6aZc=; b=dYUj1eGFS/WNu6mH1j+oWJahkTS1abry+5r0Ya9yN2hfTzCo9E1NkvvSjhMyY4kDhE xGoK+Do9u7OEqGZMongl9ZwGazAAEnZmGpkm+VlBEEZd4bjoMVrRwRXKX6VF+WYhNFyn zLxm+JxrnBfneMUE+L+eAIdGYGU3w+wzX/Q+2wq0IQd7JOehnU3jopOS7EcMux6v0dQz AtDUHKuqEIxcSQAhjK7sHdKOtjY/YgLIgLPFIR/3MV5pVV0xmzjcnsKrJfXDtZgKaCqh INH4TZE4TYkxuKrEBX7zB6OQ+I+5VR6M3qvC3x+dg9qWVHbSmJGVBiSaWdbNRwwEz9fH z0ew== X-Gm-Message-State: AKaTC036SgdgjmVDLd++z0uUApEz9lgjAZbAxrW2dtgfrwrsrIxwDs6RIjXuVXo0vAHvDVrA X-Received: by 10.237.59.230 with SMTP id s35mr637696qte.151.1479866578813; Tue, 22 Nov 2016 18:02:58 -0800 (PST) Received: from [10.0.0.62] (www.mrbrklyn.com. [96.57.23.82]) by smtp.googlemail.com with ESMTPSA id 14sm15200347qtp.19.2016.11.22.18.02.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 18:02:58 -0800 (PST) From: ruben safir X-Google-Original-From: ruben safir Newsgroups: alt.comp.lang.learn.c-c++ X-Mozilla-News-Host: news://news.panix.com:119 Message-ID: <969deb56-5db0-c229-f1d3-71df8565f5a0-at-mrbrklyn.com> Date: Tue, 22 Nov 2016 21:02:57 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 23 Nov 2016 01:17:26 -0500 Subject: [Learn] declare a func or call an object X-BeenThere: learn-at-nylxs.com X-Mailman-Version: 2.1.17 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: learn-bounces-at-nylxs.com Sender: "Learn"
Troubles trying to understand this textbook I'm reading
How do I know that std::thread t(hello);
is an object call instead of a function declaration returning a type of std:thread
Later this text has
std::thread my_thread(background(task) ); where background() is an overload of the operator ()() in the class background.
It suggests that indeed, this is a function declarion and the fix is
std::Thread my_thread((backround())) ; <--yike! what does the extra parens do?
also
std::thread my_threads{background_task}; <- which is the new syntax for an assignment
my_thread{ _______________________________________________ Learn mailing list Learn-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/learn
|
|