N3905: Extending std::search to use Additional Searching Algorithms (Version 4) -- Marshall Clow

Note: This paper was among the papers adopted into the draft Library Fundamentals TS yesterday at the Issaquah WA USA ISO C++ meeting.

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N3905

Date: 2014-02-14

Extending std::search to use Additional Searching Algorithms (Version 4)

by Marshall Clow

Excerpt:

Note: This is an update of n3703, from the summer 2013 mailing. ...

std::search is a powerful tool for searching sequences, but there are lots of other search algorithms in the literature. For specialized tasks, some of them perform significantly better than std::search. In general, they do this by precomputing statistics about the pattern to be searched for, betting that this time can be made up during the search.

The basic principle is to break the search operation into two parts; the first part creates a "search object", which is specific to the pattern being searched for, and then the search object is passed, along with the data being searched, to std::search.

This is done by adding an additional overload to std::search, and some additional functions to create the search objects.

Two additional search algorithms are proposed for inclusion into the standard: "Boyer-Moore" and "Boyer-Moore-Horspool". Additionally, the interface for the search objects is documented so that library implementers and end users can create their own search objects and use them with std::search.

...

Thanks to LWG, which reviewed an earlier version of this document, Matt Austern, who suggested overloading std::search, and especially Daniel Krügler, who wrote most of the wording for the standard, and Stephan T. Lavavej, who reviewed it.

NT² 3.0 and Boost.SIMD -- Stable release

TThe first stable release of the 3.x series of MetaScale’s open-source software is available: NT² 3.0. It also includes its spin-off project, Boost.SIMD (not yet a Boost library). Many Issues have been closed since last beta. The main focus of this release cycle was to fix performances issues and to stabilize some parts of the API.

NT² 3.0 Release Announcement

Source and binary packages can be downloaded here

Full changelog is available here

Find the Bug -- Andrzej Krzemieński

Can you spot the bug?

Find the Bug

by Andrzej Krzemieński

From the article:

Today, let's take a short test. Find what is likely to be a bug in the following code and suggest how to fix it.

void Catalogue::populate(vector<string> const& names)
{
  vec_.clear();
  vec_.resize(names.size());

  for (size_t i = 0; i < names.size(); ++i)
    vec_[i] = make_unique<Entry>(names[i]);
}

C++ Papers for Issaquah - Library, Graphics, Networking, Numerics and Undefined Behavior

This is the last part in the series for Issaquah, and its the most diverse:

C++ Papers for Issaquah - Library, Graphics, Networking, Numerics & Undefined Behavior

by Jens Weller

From the Article:

The 4th and last part about the C++ Papers for Issaquah. I already covered the first batch of proposals from the Library subgroup in the previous part, now its all about papers from Library, Graphics, Networking, Numerics and Undefined Behavior. A very diverse part.

C++ Papers for Issaquah - Library I

The third part of my series about the papers for Issaquah is about the first batch of library proposals

C++ Papers for Issaquah - Library I

by Jens Weller

From the article:

The 3rd part of the C++ papers for Issaquah series will be about the library proposals. The last part covered the papers from concepts, database and evolution. There are a lot of proposals from the library group, and I think some of them are the most interesting, as they don't have any impact on the core language.

C++ Now 2014 sold out in under a month

cppnow14-soldout.pngAs interest in C++ keeps rising, there are more C++ events but they are also selling out faster. C++ Now 2013, Going Native 2013, and C++ and Beyond 2013 all sold out, some six months before the event.

Now C++ Now 2014 has sold out faster than last year -- this time it sold out in less than a month since registration opened, with over three months left to go.

The good news: You can still register to get on the waiting list, and if you act now there's a good chance you can still get a seat. Each year there will be some number of cancellations, and the organizers expect to be able to take a number of people on the waiting list.

If you have not yet registered for C++ Now 2014 but are interested in potentially going, even if you're not certain yet you should join the waiting list today to get in the queue for a chance to sign up for the last few seats that will open up!

 

If you missed registering for C++ Now and don't make the waiting list, don't despair -- there will be additional major C++ events around the world later this year. Watch for upcoming announcements here on isocpp.org. Stay tuned...

Quick Q: What's the difference between std::merge and std::inplace_merge? -- StackOverflow

Quick A: "Inplace" can deal with overlapping ranges, but will take either more space or more time.

Today on StackOverflow:

Difference between std::merge and std::inplace_merge?

What is the difference between std::merge and std::inplace_merge in terms of complexity and result when it is executed on two consecutive ranges with elements that are all different ? (I am not a native english speaker and I am not sure to clearly understand what "inplace" means)

Overload 119 is now available

overload-119.PNGOverload 119 is now available. It contains the following C++-related articles, and more:

 

Overload 119

Feature: Static Polymorphic Named Parameters in C++ -- Martin Moene

Adding parameters to an object can be messy. Here is a description of method chaining -- an interesting way to pass parameters into methods in a more readable fashion.

Capturing Lvalue References in C++11 Lambdas -- Pete Barber

How confusing does it get when references refer to references and references are captured by value? Pete Barber shows us that it all falls out in the C++ consistency wash.

C++ Papers for Issaquah - Concepts, Database and Evolution

This is the second part of my series about the papers for the next C++ committee meeting in Issaquah:

C++ Papers for Issaquah - Concepts, Database & Evolution

by Jens Weller

From the article:

This is the second part about the papers for the C++ committee meeting in February in Issaquah. This time featuring papers from the subgroups of concept, database and evolution. Again, most papers in this series aim for a standard after C++14, most important for C++14 will be the national comments on the new standard. Also there are no new papers from the core working group, only the active issues, defects report and closed issues report are on this mailing.

 

Quick Q: Why does unique_ptr take two template parameters when shared_ptr only takes one? -- SO

Recently on StackOverflow:

Why does unique_ptr take two template parameters when shared_ptr only takes one?

Both unique_ptr and shared_ptr accept a custom destructor to call on the object they own. But in the case of unique_ptr, the destructor is passed as a template parameter of the class, wherease the type of shared_ptr's custom destructor is to be specified as a template parameter of the constructor.

template <class T, class D = default_delete<T>>
class unique_ptr
{
    unique_ptr(T*, D&); //simplified
    ...
};

and

template<class T>
class shared_ptr
{
    template<typename D>
    shared_ptr(T*, D); //simplified
    ...
};

I can’t see why such difference. What requires that?