|
Are there any downsides with using make_shared<T>() instead of using shared_ptr<T>(new T) .
Boost documentation states
There have been repeated requests from users for a factory function that creates an object of a given type and returns a...
Started by Tobbe on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
In addition to the points presented by Caspin, even weaker one:
If you use weak_ptr... .
So try to always use make_shared.
Pretty weak points.
That means your shared pointers have to use a vanilla deleter.
This isn't supported, but it isn't.
|
|
I am developing a shared library(.so) and dll. I have a global variable which is updated in multiple threads. So I have mutex lock for synchronization.
I am not clear whether global data in shared library is shared across process. If it is then I need...
Started by Andy on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
You can find more information on MSDN in the article titled " How do I ... .
However, you can use a data segment (data_seg) in order to share global variables across processes.
By default, no, global variables are not shared across processes.
|
|
Boost::shared_ptr has an unusual constructor
template<class Y> shared_ptr(shared_ptr<Y> const & r, T * p);
and I am a little puzzled as to what this would be useful for. Basically it shares ownership with r , but .get() will return p . not...
Started by Evan Teran on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
It is optimization_ptr, like the following:....
It is useful when you want to share a class member and an instance of the class is already a shared A ); shared_ptr<int> b( a, a->B );
they share the use count and stuff.
|
Ask your Facebook Friends
|
Update: the shared_ptr in this example is like the one in Boost, but it doesn't support shared_polymorphic_downcast (or dynamic_pointer_cast or static_pointer_cast for that matter)!
I'm trying to initialize a shared pointer to a derived class without ...
Started by Lajos Nagy on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
I think you want dynamic_pointer_cast or shared() { } }; // dynamic casts require polymorphic types struct Derived : public Base { }; boost::shared_ptr<Base> base(new Base()); boost....
I assume you're using boost::shared_ptr ...
|
|
Our app depends on an external, 3rd party-supplied configuration (including custom driving/decision making functions) loadable as .so file.
Independently, it cooperates with external CGI modules using a chunk of shared memory, where almost all of its ...
Started by SF. on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
I would strongly recommend you don't go that way - putting data that needs to be shared in shared memory in mind when using shared memory....
Placing actual C++ objects in shared memory is very, very difficult, as you have found.
|
|
I'm trying to create a shared object (.so) that will make it so, by including one shared object with -lboost , I implicitly include all the boost libraries. Here's what I tried:
#!/bin/sh BOOST_LIBS="-lboost_date_time-gcc43-mt -lboost_filesystem-gcc43...
Started by Joey Adams on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
I've just tried this:
$ export BOOST_ROOT=/home/ghost/Work/Boost/boost-svn $ g++ -shared.
Help you).
|
|
Hi guys,
I'm trying to embed a small view snippet that steps through a model fragment that works fine when I embed it in a single controller and pass it to a view like so;
Controller: return View(_entities.formTemplate.ToList());
View:
http://www.pastie...
Started by Eric Bennett on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
You have a couple of options if you go....
You'll want to use the HtmlHelper method DropDownList() in order to create a input:
<%= Html.DropDownList("id", new SelectList(formBuilder, "ID", "Name")) %>
You probably want to use a ViewUserControl here .
|
|
This question is similar to this one , but not a duplicate because I'm asking about issues not discussed in that question.
I have a client-server project in Delphi 7 with the following directory structure:
\MyApp \MyClientApp \MyServerApp \lib
There are...
Started by Liron Yahdav on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
All too often, you'll be tempted to edit one of the shared files....
I dislike having files shared by projects.
If you do not explicitly project as any other unit .
I usually create a package with all shared unit, and just use the units.
|
|
Let's say I have a drive such as "C:\", and I want to find out if it's shared and what it's share name (e.g. "C$") is.
To find out if it's shared, I can use NetShareCheck .
How do I then map the drive to its share name? I thought that NetShareGetInfo ...
Started by MOE37x3 on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
I'm not sure : WNetGetConnection will give you the path associated with a mapped network drive, but not the share.
SHGetFileInfo with SHGFI_ATTRIBUTES
upon return check the dwAttributes flag for SFGAO_SHARE.
|
|
How does libtool decide to build a shared library or not?
Chenz
Started by Crazy Chenz on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
To build only one kind, ....
From http://www.manpagez.com/man/1/libtool/
Libtool can create either dynamically linked shared Automake and Autoconf, then Libtool builds both shared and static by default if they are supported on your platform.
|