add to "to_concurrent_vector_builder"

Oct 2, 2013 at 8:16 AM
Please add "to_concurrent_vector":

include <concurrent_vector.h>

    struct to_concurrent_vector_builder_builder : base_builder
    {
        typedef                 to_concurrent_vector_builder       this_type       ;

        size_type               capacity;

        CPPLINQ_INLINEMETHOD explicit to_concurrent_vector_builder (size_type capacity = 16U) throw ()
            :   capacity    (capacity)
        {
        }

        CPPLINQ_INLINEMETHOD to_concurrent_vector_builder (to_concurrent_vector_builder const & v) throw ()
            :   capacity (v.capacity)
        {
        }

        CPPLINQ_INLINEMETHOD to_concurrent_vector_builder (to_concurrent_vector_builder && v) throw ()
            :   capacity (std::move (v.capacity))
        {
        }

        template<typename TRange>
        CPPLINQ_METHOD Concurrency::concurrent_vector<typename TRange::value_type> build (TRange range) const
        {
            Concurrency::concurrent_vector<typename TRange::value_type> result;
            result.reserve (capacity);

            while (range.next ())
            {
                result.push_back (range.front ());
            }

            return std::move (result);
        }

    };

CPPLINQ_INLINEMETHOD detail::to_concurrent_vector_builder    to_concurrent_vector (size_type capacity = 16U) throw ()
{
    return detail::to_concurrent_vector_builder (capacity);
}
Coordinator
Oct 7, 2013 at 7:49 PM
concurrent_vector isn't in standard C++ AFAIK, however we could add it as VS specific feature perhaps under namespace cpplinq::vs ?

Do you mind preparing a pull request with this and I can merge it for you.