Hi, any idea on what is this code doing:
//=============== =============== ===
1 #include <boost/scoped_ptr.hpp>
....
3 typedef std::vector<std ::vector<pair<s ize_t, size_t ParamsType;
5 /*
6 *Is the following a boost shared pointer to a "ParamsType " object?
7 */
8 shared_ptr<Para msType>& params;
....
14 params.reset(ne w ParamsType(m_pr ed_map->size()));
15 for (size_t pid = 0; pid < m_pred_map->size(); ++pid) {
16 vector<pair<siz e_t, size_t& param = (*params)[pid]; // ??
...
}
//=============== =============== ===
I have problems with lines 14 & 16. First of all, is ParamsType a vector
of vectors of pairs? Then I think params is a pointer to that. Then, we
probably instantiate a new ParamsType and let params point at it. Right?
But then, what's happening in line 16?
Thanks in advance
Giuseppe 3 1166
Anybody? please.. :) Is
vector<pair<siz e_t, size_t& param = (*params)[pid];
a kind of cast?
cheers
Giuseppe
Giuseppe:G: wrote:
Hi, any idea on what is this code doing:
//=============== =============== ===
1 #include <boost/scoped_ptr.hpp>
...
3 typedef std::vector<std ::vector<pair<s ize_t, size_t ParamsType;
5 /*
6 *Is the following a boost shared pointer to a "ParamsType " object?
7 */
8 shared_ptr<Para msType>& params;
...
14 params.reset(ne w ParamsType(m_pr ed_map->size()));
15 for (size_t pid = 0; pid < m_pred_map->size(); ++pid) {
16 vector<pair<siz e_t, size_t& param = (*params)[pid]; // ??
...
}
//=============== =============== ===
I have problems with lines 14 & 16. First of all, is ParamsType a vector
of vectors of pairs? Then I think params is a pointer to that. Then, we
probably instantiate a new ParamsType and let params point at it. Right?
But then, what's happening in line 16?
Thanks in advance
Giuseppe
On Jul 6, 6:30*pm, Giuseppe:G: <lone.nt...@SPA Mlibero.itwrote :
Anybody? please.. :) Is
vector<pair<siz e_t, size_t& param = (*params)[pid];
a kind of cast?
cheers
Giuseppe
Giuseppe:G: wrote:
Hi, any idea on what is this code doing:
//=============== =============== ===
1 #include <boost/scoped_ptr.hpp>
...
3 typedef std::vector<std ::vector<pair<s ize_t, size_t ParamsType;
5 /*
6 *Is the following a boost shared pointer to a "ParamsType " object?
7 */
8 shared_ptr<Para msType>& params;
...
14 params.reset(ne w ParamsType(m_pr ed_map->size()));
15 for (size_t pid = 0; pid < m_pred_map->size(); ++pid) {
16 * * * vector<pair<siz e_t, size_t& param = (*params)[pid];// ??
* * ...
}
//=============== =============== ===
I have problems with lines 14 & 16. First of all, is ParamsType a vector
of vectors of pairs? Then I think params is a pointer to that. Then, we
probably instantiate a new ParamsType and let params point at it. Right?
But then, what's happening in line 16?
If you think of it as a 2D matrix of "pair" objects, then this loop is
getting each "row" of of the matrix. The term "param" in most cases
would be used as a reference, because it is easier to read/type than
repeating "(*params)[pid]" everywhere else in the loop. It is just an
alias.
hth,
Joe Cook
Thanks Joe! Now I get it. It's as if we're "isolating" single rows ( or
columns) and then managing them through param.
Regards
Giuseppe
joseph cook wrote:
If you think of it as a 2D matrix of "pair" objects, then this loop is
getting each "row" of of the matrix. The term "param" in most cases
would be used as a reference, because it is easier to read/type than
repeating "(*params)[pid]" everywhere else in the loop. It is just an
alias.
hth,
Joe Cook
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ray |
last post by:
I'm using VB6, I am a little more then a novice but not much..
and my question is - Is there a way to detect and possibly notify
(me/mycomputer) if someone is using a Web Cam mainly MSN on my LAN with out
the user knowing it? Even if I have to install software on the user
computer..
I not sure if this is the right way to go about this
I can get the WM_CAP_DRIVER_CONNECT to return a True/False but this brings
up a (Video Source...
|
by: michael |
last post by:
Hello,
Apologies if this seems like a trivial question, but it would help me
with my python, coming from a Java background.
What is the preferred naming convention for a .py file, that contains a
class ? For example, if I have one class (MyClass), I wouldn't really
want to put it in myclass.py, as I'd end up referencing myclass.MyClass
(unless I use the import-from which I'm trying to avoid).
|
by: soni29 |
last post by:
hi,
i have a small question regarding sql, there are two tables that i
need to work with on this, one has fields like:
Table1:
(id, name, street, city, zip, phone, fax, etc...) about 20 more
columns
Table2:
name
what i need help with is that table2 contains about 200 distinct names
that i need to insert into table1, i'm using sql server, is there a
|
by: Rakesh |
last post by:
Hi,
I was writing this C++ program wherein I used an include statement
like -
#include <iostream.h>
I was told by my co-worker that this form of including a file is
deprecated and should not be used, instead it ought to be something
like
|
by: Steve |
last post by:
I have a SQL query I'm invoking via VB6 & ADO 2.8, that requires three
"Left Outer Joins" in order to return every transaction for a specific
set of criteria.
Using three "Left Outer Joins" slows the system down considerably.
I've tried creating a temp db, but I can't figure out how to execute
two select commands. (It throws the exception "The column prefix
'tempdb' does not match with a table name or alias name used in the
query.")
| |
by: Dalan |
last post by:
Please help - just take a quick look at the function code below. It
probably just needs some minor tweaking.
The function module is based on an intermediate query to provide a
group record total from a subform that is posted to a field on the
main form. "Everything seems to work fine" except that I consistently
receive an error everytime I attempt to create a new record on the
main form. However, there are no errors received when...
|
by: Lasse Vågsæther Karlsen |
last post by:
I've been using XML Documentation in my class libraries since I
discovered this, and I have been using NDoc to produce help files from
the xml files so that the documentation is available outside of Visual
Studio as well.
With the introduction of .NET 2.0, generics, iterators, etc. NDoc seems
to be behind in support for this. I've looked at the code but unless
you're one of the main contributors I think it's going to be hard to
just...
|
by: toch3 |
last post by:
i am writing a c program that is basically an address book. the only
header we are using is #include<stdio.hwe are to use a global array,
loops, and pointers. we are to have a menu at the beginning. 1. add new
record 2. search for a record 3 modify a record 4. delete a record 5.
view all records 6.exit in each of these menu's we are to be able to
print the record to an exterior printer.
: i have started my global array, and program, but...
|
by: QbProg |
last post by:
Hello,
I did some experiments with VC++ 2005, and some ILDasm. Please tell me
if I have understood the concepts of C++ programming under .NET, since
I'm a bit confused!
--
There are 4 types of classes in VC++/CLI:
Unmanaged classes (i.e. normal classes compiled in a unmanaged source
or dll , the code is unmanaged and CPU native). Accessible from C++/CLI
|
by: Jo |
last post by:
Hi there,
I'm Jo and it's the first time I've posted here. I'm in process of creating
a database at work and have come a little unstuck.....I'm a bit of a novice
and wondered if anyone could help. I work in a library and send out dual
language books to babies of dual or other nationality.
The db is to be used for logging a range of book titles and numbers ordered
and books sent out to individuals. I am trying to work out a way of...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |