static_list
От: alnsn Великобритания http://nasonov.blogspot.com
Дата: 24.09.03 18:01
Оценка: 27 (1)
http://cpp-experiment.sourceforge.net/static_list/static_list.html

Mozhet komu nuzhen takoj zver'? Tol'ko chto sprosil v booste ob interese. Zavtra posmotrim, chto narod skazhet
Re: static_list
От: alnsn Великобритания http://nasonov.blogspot.com
Дата: 24.09.03 18:04
Оценка:
Здравствуйте, alnsn, Вы писали:

A>http://cpp-experiment.sourceforge.net/static_list/static_list.html


A>Mozhet komu nuzhen takoj zver'? Tol'ko chto sprosil v booste ob interese. Zavtra posmotrim, chto narod skazhet



Zabyl header file:

http://cpp-experiment.sourceforge.net/static_list/static_list.hpp
Re: static_list
От: MaximE Великобритания  
Дата: 24.09.03 19:04
Оценка:
Здравствуйте, alnsn, Вы писали:

A>http://cpp-experiment.sourceforge.net/static_list/static_list.html


A>Mozhet komu nuzhen takoj zver'? Tol'ko chto sprosil v booste ob interese. Zavtra posmotrim, chto narod skazhet


Круто!

Основная идея реализации очень похожа на linked_ptr<>. Приятно, что никакого динамического выделения памяти под элементы.

P.S. В доке можно упомянуть, что это monostate pattern.
Re[2]: static_list
От: MaximE Великобритания  
Дата: 24.09.03 19:44
Оценка:
Здравствуйте, MaximE, Вы писали:

ME>Здравствуйте, alnsn, Вы писали:


A>>http://cpp-experiment.sourceforge.net/static_list/static_list.html


A>>Mozhet komu nuzhen takoj zver'? Tol'ko chto sprosil v booste ob interese. Zavtra posmotrim, chto narod skazhet


ME>Круто!


Жалко, что не все так сладко (после комментариев David'a Abrahams'a и E. Gladyshev'a.)
Re[3]: static_list
От: alnsn Великобритания http://nasonov.blogspot.com
Дата: 25.09.03 07:55
Оценка: 27 (1)
Здравствуйте, MaximE, Вы писали:

ME>Здравствуйте, MaximE, Вы писали:


ME>>Здравствуйте, alnsn, Вы писали:


A>>>http://cpp-experiment.sourceforge.net/static_list/static_list.html


A>>>Mozhet komu nuzhen takoj zver'? Tol'ko chto sprosil v booste ob interese. Zavtra posmotrim, chto narod skazhet


ME>>Круто!


ME>Жалко, что не все так сладко (после комментариев David'a Abrahams'a и E. Gladyshev'a.)


Может наша еще возьмет?

http://lists.boost.org/MailArchives/boost/msg52760.php


David Abrahams wrote:

> It's a nice idea to formalize this. I've used the idiom in the past.

> The one *major* problem with it is that a translation unit's static
> initialization is not required to happen until such time as some
> function in that translation unit is invoked. The result is that you
> can't simply link together TUs which contain some class description
> and the associated registration object, and expect the registration to
> happen.

// Translation_unit_1.cpp
#include "static_list.hpp"
static_list<char const*>::insert filename1("Translation_unit_1.cpp");


// Translation_unit_2.cpp
#include "static_list.hpp"
static_list<char const*>::insert filename2("Translation_unit_2.cpp");

Both translation units include static_list.hpp. Later, when you call
static_list<char const*>::begin you are calling it as a function defined
inline in both translation units. At least yesterday it was my argument
against this paragraph in standard:

3.6.2 / 3
It is implementation defined whether or not the dynamic initialization (8.5,
9.4, 12.1, 12.6.1) of an object of namespace scope is done before the first
statement of main. If the initialization is deferred to some point in time
after the first statement of main, it shall occur before the first use of
any function or object defined in the same translation unit as the object
to be initialized.31) [Example:
[skiped]


3.7.1 / 2
If an object of static storage duration has initialization or a destructor
with side effects, it shall not be eliminated even if it appears to be
unused, except that a class object or its copy may be eliminated as
specified in 12.8.

Ctor of static_list<char const*>::insert has side effect. It modifies
static_list<char const*>::m_head and static_list<char const*>::m_size.
Later or sooner it should be called.

> Ultimately, to be reliable, you need explicit calls to initialization

> functions , which makes this technique much less useful than it
> could be.

I still hope that static_list<char const*>::begin is enough. I should check
where inline functions are defined, though.
Re[4]: static_list
От: MaximE Великобритания  
Дата: 25.09.03 07:59
Оценка:
Здравствуйте, alnsn, Вы писали:

A>>>>http://cpp-experiment.sourceforge.net/static_list/static_list.html


A>>>>Mozhet komu nuzhen takoj zver'? Tol'ko chto sprosil v booste ob interese. Zavtra posmotrim, chto narod skazhet


ME>>>Круто!


ME>>Жалко, что не все так сладко (после комментариев David'a Abrahams'a и E. Gladyshev'a.)


A>Может наша еще возьмет?


A>http://lists.boost.org/MailArchives/boost/msg52760.php


Хорошо бы
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.