Dave Abrahams | 1 Apr 2012 04:12
Picon
Picon
Favicon
Gravatar

C++11 Metaprogramming


Hi All,

I am on the C++Now 2012 schedule giving a talk on metaprogramming in
C++11, which is really just supposed to be an overview of the state of
the art.  I am just at the beginnings of my research for this
presentation, having learned a few things and done a few experiments,
and it seemed to me foolish not to ask the Boost community for its
insights.  I'm sure y'all have come up with many neat tricks and
techniques.  If you'd care to share them here, that would be much
appreciated.

TIA,

--

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Michel Morin | 1 Apr 2012 05:36
Picon

Re: [result_of] Test fails on clang trunk and gcc-4.7 due to changes in FDIS

Michel Morin wrote:
>> Could you file a bug?
>
> OK, I will file a bug later.

Done.
  https://svn.boost.org/trac/boost/ticket/6754

> Also, the implementation needs to be modified.
> The current implementation of decltype-based boost::result_of
> does not use decltype for function pointers.
> So, for "typedef const int F();"
> * boost::result_of<F&()>::type is int,
> * boost::result_of<F*()>::type is const int,
> on a compiler with N3290 decltype.

I also created a ticket for this. A patch attached in the ticket.
  https://svn.boost.org/trac/boost/ticket/6755

Regards,
Michel

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Paul A. Bristow | 1 Apr 2012 10:54

Refactoring a library for header-only or linked library?

I am considering refactoring a (potential Boost) library separating declarations and definitions
into two sets of files with the objective of  reducing compilation times and allow it to be used as
header-only or linking with a pre-built library.

Is there is best/Boost way of doing this?

Is there a Boost library that I should use as a model?  ASIO?

Should I call the definition files .cpp or .ipp?

Should definition files go in libs/src or in boost/?

How should I control the header-only/library switch?

View and suggestions?

Thanks

Paul

---
Paul A. Bristow,
Prizet Farmhouse, Kendal LA8 8AB  UK
+44 1539 561830  07714330204
pbristow <at> hetp.u-net.com

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

(Continue reading)

Artyom Beilis | 1 Apr 2012 10:58
Picon
Favicon

Re: [Locale] VC11 Regressions


>________________________________
> From: Joshua Boyce <raptorfactor <at> raptorfactor.com>
>To: boost <at> lists.boost.org 
>Sent: Friday, March 30, 2012 3:47 PM
>Subject: [boost] [Locale] VC11 Regressions
> 
>I am currently porting some code to the VC11 compiler beta, and as part of
>that process I ran the unit tests on the libraries I use and noticed some
>failures in Boost.Locale under VC11 that are not present under VC10.
>
>Ones of the tests (test_winapi_collate) actually crashes (showing the WER
>dialog etc).
>
>Logs for comparison (tests were run on trunk):
>http://dl.dropbox.com/u/74751/cpp/boost/logs/locale-test-vc10-20120330-2143.txt
>http://dl.dropbox.com/u/74751/cpp/boost/logs/locale-test-vc11-20120330-2143.txt
>
>Has anyone else observed this or is it a configuration issue on my end?
>

- Can you please give me a stack trace on the point it crashes?
- Also what version of OS do you run  (XP/Vista/7/8)?
- Is this 32 or 64 bit build?
- Any other tests failing?
- Do you compile with ICU if yes what version?

Thanks!
 
Artyom Beilis
(Continue reading)

Martin Geisler | 1 Apr 2012 12:09
Favicon
Gravatar

Re: [git] Mercurial? easy merging in svn, how about git/hg?

Frank Birbacher <bloodymir.crap <at> gmx.net> writes:

> Hi!
>
> Am 29.03.12 22:18, schrieb Martin Geisler:
>> Blocking changes is harder because we always use three-way merges
>> instead of re-playing patches. If you know that you don't need a
>> particular changeset again, then you can back it out. This is just
>> a way of applying the reverse patch from that changeset.
>>
>> +x    +y    -x a --- b --- c --- d --- f
>
> Ok, this means removing the changes from a branch. But what for the
> following: consider a stable and a development branch, just as in your
> example. Bugfixes go to stable and features go to development. Once in
> a week someone merges the stable branch into dev to bring all bugfixes
> into dev. Now someone fixes a bug on stable which shall be fixed
> differently on dev, here shown as z and z':
>
>   dev:    ... a --- b --- c --- d --- z'
>                    /           /
>   stable: ... --- x --------- y --- z
>
> The z and z' are logically the same fix, but syntactically they are
> different. With svn you could block z from being merged into dev
> (effective when the merge will happen sometime in the future.) With a
> three-way merge this seems not easily possible. A merge from will
> reproduce the z in dev (ancestor is y currently.) So you will have to
> produce a new common ancestor of dev and stable right on the spot,
> meaning to do a merge and somehow remove z from it.
(Continue reading)

Artyom Beilis | 1 Apr 2012 12:44
Picon
Favicon

Re: [Locale] VC11 Regressions

> Logs for comparison (tests were run on trunk):

> http://dl.dropbox.com/u/74751/cpp/boost/logs/locale-test-vc10-20120330-2143.txt
> http://dl.dropbox.com/u/74751/cpp/boost/logs/locale-test-vc11-20120330-2143.txt
> 
> Has anyone else observed this or is it a configuration issue on my end?
> 

Is there any chance that static runtime used instead of dynamic?

Because it seems that there are many failures, looks like
the facets are not installed, and this mostly caused by
inconsistent dynamic/statlic linking.

Artyom Beilis

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Mathias Gaunard | 1 Apr 2012 15:24

Re: C++11 Metaprogramming

On 04/01/2012 04:12 AM, Dave Abrahams wrote:
>
> Hi All,
>
> I am on the C++Now 2012 schedule giving a talk on metaprogramming in
> C++11, which is really just supposed to be an overview of the state of
> the art.  I am just at the beginnings of my research for this
> presentation, having learned a few things and done a few experiments,
> and it seemed to me foolish not to ask the Boost community for its
> insights.  I'm sure y'all have come up with many neat tricks and
> techniques.  If you'd care to share them here, that would be much
> appreciated.

 From a pure meta-programming perspective, I guess the only real 
addition is variadic templates.
However, there is the problem that they're fairly limited and that one 
may not expand them as the arguments of a non-variadic template.
Since I need to integrate with other libraries and tools, I therefore 
use them very rarely.

One very useful use of variadic templates however is with function 
templates. They allow to make a function template with 0 arguments, 
which wasn't possible in C++03. This can be used to delay instantiation 
of the function body which can be necessary if name resolution needs to 
happen later.
This is also possible with the new function template default arguments.

A new possibility with C++11 is the use of SFINAE to test arbitrary 
expressions. I have not found this to be particularly useful in 
practice, however.
(Continue reading)

Pyry Jahkola | 1 Apr 2012 15:31
Picon
Picon
Favicon
Gravatar

Re: C++11 Metaprogramming

Hi,

On 2012-04-01 02:12:24 +0000, Dave Abrahams said:

> I am on the C++Now 2012 schedule giving a talk on metaprogramming in
> C++11  (...)  I'm sure y'all have come up with many neat tricks and
> techniques.  If you'd care to share them here, that would be much
> appreciated.

Below are a few tricks I've used with varying success with the trunk 
version of clang and libc++ with C++11 compilation turned on. Some 
might be obvious, some not, but at least they are some improvement over 
their C++03 counterparts.

The text turned out to be quite lengthy, so here's a link to a 
syntax-colored and more reader-friendly Gist: 
https://gist.github.com/2275320

See you all in Aspen!
/Pyry Jahkola

* * *

1) Using variadic class templates recursively, like in the definitions 
for "add<T...>" here:

    #include <type_traits>

    // A few convenience aliases first
    template <typename T, T N> using ic   = std::integral_constant<T, N>;
(Continue reading)

Daniel Trebbien | 1 Apr 2012 16:47
Picon

[test] Ticket #6624 (Add a BOOST_<level>_NE_COLLECTIONS testing tool)

Hello,

I have been unable to reach the current maintainer of Boost.Test
regarding Ticket #6624:  https://svn.boost.org/trac/boost/ticket/6624

Would someone like to review my patch for this small enhancement and commit it?

Daniel Trebbien

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Vicente J. Botet Escriba | 1 Apr 2012 16:59
Picon

Re: Refactoring a library for header-only or linked library?

Le 01/04/12 10:54, Paul A. Bristow a écrit :
> I am considering refactoring a (potential Boost) library separating declarations and definitions
> into two sets of files with the objective of  reducing compilation times and allow it to be used as
> header-only or linking with a pre-built library.
>
> Is there is best/Boost way of doing this?
>
> Is there a Boost library that I should use as a model?  ASIO?
>
> Should I call the definition files .cpp or .ipp?
The definitions should be on a header file and  .ipp or .hpp is good for 
me. Boost.Chrono uses .hpp header files.
> Should definition files go in libs/src or in boost/?
Boost.Chrono includes them in boost/chrono/detail/inlined directory. 
libs/xxx/src should not work as an installer don't need to install this 
directory.
>
> How should I control the header-only/library switch?
Boost.Chrono uses a macro to BOOST_CHRONO_HEADER_ONLY as the goal was to 
make the library header-only.

#ifdef BOOST_CHRONO_HEADER_ONLY
#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
#else
#include <boost/chrono/detail/inlined/chrono.hpp>
#endif

The config.hpp file contains

#ifdef BOOST_CHRONO_HEADER_ONLY
(Continue reading)


Gmane