Skip to content

Commit

Permalink
ARROW-5252: [C++] Use standard-compliant std::variant backport
Browse files Browse the repository at this point in the history
Replace mapbox::variant with Michael Park's variant implementation.

Author: Antoine Pitrou <antoine@python.org>

Closes #4259 from pitrou/ARROW-5252-variant-backport and squashes the following commits:

03dbc0e <Antoine Pitrou> ARROW-5252:  Use standard-compliant std::variant backport
  • Loading branch information
pitrou committed May 6, 2019
1 parent 790c142 commit 89a18b5
Show file tree
Hide file tree
Showing 20 changed files with 2,929 additions and 1,323 deletions.
59 changes: 28 additions & 31 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -406,37 +406,6 @@ DEALINGS IN THE SOFTWARE.

--------------------------------------------------------------------------------

This project includes code from the mapbox/variant project, BSD 3-clause
license

Copyright (c) MapBox
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
- Neither the name "MapBox" nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------

This project includes code from the FlatBuffers project

Copyright 2014 Google Inc.
Expand Down Expand Up @@ -709,6 +678,34 @@ DEALINGS IN THE SOFTWARE.

--------------------------------------------------------------------------------

The file cpp/src/arrow/vendored/variant.hpp has the following license

Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

--------------------------------------------------------------------------------

The files in cpp/src/arrow/vendored/xxhash/ have the following license
(BSD 2-Clause License)

Expand Down
2 changes: 1 addition & 1 deletion c_glib/gandiva-glib/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ggandiva_literal_node_get(GGandivaLiteralNode *node)
{
auto gandiva_literal_node =
std::static_pointer_cast<gandiva::LiteralNode>(ggandiva_node_get_raw(GGANDIVA_NODE(node)));
return gandiva_literal_node->holder().get<Type>();
return arrow::util::get<Type>(gandiva_literal_node->holder());
}

G_BEGIN_DECLS
Expand Down
7 changes: 6 additions & 1 deletion cpp/src/arrow/compute/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ struct ARROW_EXPORT Datum {

Datum(const Datum& other) noexcept { this->value = other.value; }

Datum& operator=(const Datum& other) noexcept {
value = other.value;
return *this;
}

// Define move constructor and move assignment, for better performance
Datum(Datum&& other) noexcept : value(std::move(other.value)) {}

Expand All @@ -126,7 +131,7 @@ struct ARROW_EXPORT Datum {
}

Datum::type kind() const {
switch (this->value.which()) {
switch (this->value.index()) {
case 0:
return Datum::NONE;
case 1:
Expand Down
1 change: 0 additions & 1 deletion cpp/src/arrow/scalar.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "arrow/type_fwd.h"
#include "arrow/type_traits.h"
#include "arrow/util/decimal.h"
#include "arrow/util/variant.h"
#include "arrow/util/visibility.h"

namespace arrow {
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/arrow/util/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
#ifndef ARROW_UTIL_VARIANT_H
#define ARROW_UTIL_VARIANT_H

#include "arrow/vendored/variant/variant.hpp" // IWYU pragma: export
#include "arrow/vendored/variant/variant_io.hpp"
#include "arrow/vendored/variant.hpp" // IWYU pragma: export

namespace arrow {
namespace util {

using mapbox::util::apply_visitor; // seems akin to std::visit
using mapbox::util::bad_variant_access;
using mapbox::util::get;
using mapbox::util::variant;
using ::mpark::bad_variant_access;
using ::mpark::get;
using ::mpark::get_if;
using ::mpark::variant;
using ::mpark::visit;

} // namespace util
} // namespace arrow
Expand Down
1 change: 0 additions & 1 deletion cpp/src/arrow/vendored/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
arrow_install_all_headers("arrow/vendored")

add_subdirectory(datetime)
add_subdirectory(variant)
Loading

0 comments on commit 89a18b5

Please sign in to comment.