Giter Site home page Giter Site logo

bolero-murakami / sprout Goto Github PK

View Code? Open in Web Editor NEW
870.0 66.0 48.0 16.16 MB

C++11/14 constexpr based Containers, Algorithms, Random numbers, Parsing, Ray tracing, Synthesizer, and others.

Home Page: http://bolero-murakami.github.io/Sprout/

License: Boost Software License 1.0

CMake 0.51% C++ 99.06% HyPhy 0.05% Python 0.10% Shell 0.28%

sprout's Introduction

Sprout C++ Libraries

Welcome to the Sprout C++ Libraries

C++11/14 constexpr based Containers, Algorithms, Random numbers, Parsing, Ray tracing, Synthesizer, and others.

Library Documentation

The starting point for the documentation of individual libraries is the Libraries page, which gives a brief description of each library and links to its documentation.

Project page

Install

Through the path to the directory. /path/to/sprout
This library can be used in the header only.

Supported Compilers

Linux:

  • GCC, C++11/14/17 mode: 4.7.0~4.7.4, 4.8.0~4.8.5, 4.9.0~4.9.4, 5.1.0~5.5.0, 6.1.0~6.5.0, 7.1.0~7.4.0 8.1.0~8.2.0
  • Clang, C++11/14/17 mode: 3.2, 3.3, 3.4~3.4.2, 3.5.0~3.5.1, 3.6.0~3.6.2, 3.7.0~3.7.1, 3.8.0~3.8.1, 3.9.0~3.9.1, 4.0.0~4.0.1, 5.0.0~5.0.2, 6.0.0~6.0.1, 7.0.0

Author

Bolero MURAKAMI (Mail)

Copyrights

Copyright (C) 2011-2019 Bolero MURAKAMI.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

sprout's People

Contributors

bolero-murakami avatar fadis avatar kariya-mitsuru avatar kundor avatar lpha-z avatar minamiyama1994 avatar nekko1119 avatar osyo-manga avatar rhysd avatar ryanmrichard avatar y0z avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sprout's Issues

sprout::enabler の定義が無い

sprout::enabler_if を使用する場合は以下のような感じになるので、sprout::enabler は ODR-used になると思うのですが、sprout::enabler は GCC や clang では定義されません。

#include <sprout/type_traits/enabler_if.hpp>

template<sprout::enabler_if_t<true> = sprout::enabler>
void f() {}

int main()
{
    f();
}

ODR-used のオブジェクトが定義されていないと ill-formed になるので(ただし、no diagnostic required)、GCC や clang であっても定義すべきと思うのですが、いかがでしょうか。
ちなみに、現状 GCC では意図したとおりに動作するようですが、clang では -g オプションをつけるとリンクエラーになります。
http://melpon.org/wandbox/permlink/5ZIS1xVQL1pM4zQW

Suggestion on 'sprout::tpp::all_of'

Hi,
I'm a compiler developer from Microsoft. We build lots of RWC (real world code) projects daily to validate compiler changes and we also use the projects to identify areas to improve compiler throughput.
I recently find that 'sprout::tpp::all_of' is fairly heavy-weight and often contributes a significant amount to the compile time.
For example, 'default_remake_container' in 'sprout\container\container_construct_traits.hpp' takes a long time to do overload resolution when compiling the test testspr\sprout.cpp. This is related to the SFINAE condition in one of its overload.
It is expensive mainly because there is a specialization of 'sprout::tpp::all_of' which has 256 template arugments.

Here are some potential ways to reduce the cost:

template<bool> struct helper {};
template<> struct helper<true> { static const bool value = true; };
#ifndef FASTER
				&& !(sizeof...(Args) == 2 && sprout::tpp::all_of<sprout::is_input_iterator<typename std::remove_reference<Args>::type>...>::value)
#else
				// && !(helper<sizeof...(Args) == 2>::value && sprout::tpp::all_of<sprout::is_input_iterator<typename std::remove_reference<Args>::type>...>::value) // this approach forces the compiler to exit early when 'sizeof...(Args) == 2' is false by causing a substitution failure using 'helper'
				&& !(sizeof...(Args) == 2 && std::conjunction_v<sprout::is_input_iterator<typename std::remove_reference<Args>::type>...>) // std::conjunction_v yields the same result and is much light-weight
#endif
With either change, the compile time is improved by 10% when using clang-cl, and is improved by 30% when using MSVC.

C++20 removed std::is_literal_type

std::is_literal_type was deprecated in C++17 and removed in C++20. Section [diff.cpp17.depr]/7 of the C++20 Working Draft explains:

The traits had unreliable or awkward interfaces. The is_­literal_­type trait provided no way to detect which subset of constructors and member functions of a type were declared constexpr.

This trait is being directly used here:

: public sprout::detail::type_traits_wrapper<std::is_literal_type<T> >

In /std:c++17 mode, this triggers a deprecation warning in recent versions of MSVC. In /std:c++latest mode, now that microsoft/STL#380 has been merged, this will trigger an error in VS 2019 16.6 Preview 2.

MSVC provides "escape hatch" macros that can be defined project-wide to suppress the deprecation warning and restore the removed type trait. (Specifically, compiling with /D_SILENCE_CXX17_IS_LITERAL_TYPE_DEPRECATION_WARNING and /D_HAS_DEPRECATED_IS_LITERAL_TYPE=1.) However, it's best to avoid using this deprecated/removed machinery entirely.

I see at least three uses of sprout::is_literal_type throughout your codebase, but I'm uncertain as to how it's being used. I looked at prev, where it appears to be dispatching to logarithmic-depth recursion, possibly as a workaround when C++14 extended constexpr is unavailable. If all uses of is_literal_type are for dealing with the limitations of C++11 classic constexpr, you may want to detect whether C++14 extended constexpr is available, and if so, avoid is_literal_type entirely (which should solve the deprecation/removal issue with the latest versions of MSVC).

Examples causes compilation error.

Examples that is not constexpr cause compilation error.
Should these examples be moved into the main function?

ex)
http://bolero-murakami.github.io/Sprout/docs/libs/array/array/operator-assign.html

to

  #include <sprout/array.hpp>
  #include <sprout/assert.hpp>
  using namespace sprout;

  int main() {
    auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
    SPROUT_STATIC_CONSTEXPR auto y = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
    x = y;
    SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
  }

Getting Sprout Version

Does Sprout have a version macro that can be used to find it's version number/string?

Visual Studio 2017 (vc141) にてコンパイルエラー

https://github.com/bolero-MURAKAMI/Sprout/blob/master/sprout/type_traits/result_of.hpp

Visual Studio 2015 (vc140) ではコンパイルが通っていたのですが
Visual Studio 2017 (vc141) ではコンパイルエラーとなりました

原因はvcの以下の仕様変更でした

  • テンプレート引数にパラメータパックが含まれている場合,それはパラメータリストの最後になければならない
  • テンプレートにネストされた依存名はtypenameにより明示されなければならない

とりあえず現在はif defined(_MSC_VER) && (_MSC_VER <= 1900) ブロックをコメントアウトして対応しています(このときvc140,vc141共にコンパイルが通りました)

Failed to build Sprout on x86 due to error C2923 and C2955 with MSVC

We failed to build Sprout on x86 due to error C2923 and C2955 with MSVC. This issue can be reproduced on latest commit ea06f92. It seems that 'I' is not declared in has_sprout_get.hpp. Could you please help take a look at this? Thank you!

Environment:
Windows + VS2017

Steps to Reproduce:
1.git clone https://github.com/bolero-MURAKAMI/Sprout.git D:\Sprout\src
2.Open a VS 2017 x86 command prompt and browse to D:\Sprout
3.cd src
4.cl /std:c++latest /EHsc /I. /constexpr:steps100000000 testspr\sprout.cpp

log_x86_build.log

Actual result:
sprout.cpp
.\sprout/tuple/tuple/has_sprout_get.hpp(48): error C2923: 'sprout::tuples::detail::has_sprout_get': 'I' is not a valid template type argument for parameter 'Base_'
.\sprout/tuple/tuple/has_sprout_get.hpp(46): note: see declaration of 'I'
.\sprout/tuple/tuple/has_sprout_get.hpp(49): note: see reference to class template instantiation 'sprout::tuples::has_sprout_get<T,I>' being compiled
D:\Sprout\src\testspr../libs/bitset/test/bitset.cpp(21): note: see reference to class template instantiation 'sprout::bitset<40>' being compiled
D:\Sprout\src\testspr../libs/string/test/string.cpp(23): note: see reference to class template instantiation 'sprout::basic_string<char,8,sprout::char_traits>' being compiled
with
[
T=char
]
.\sprout/string/string.hpp(121): note: see reference to class template instantiation 'sprout::char_traits' being compiled
with
[
T=char
]
.\sprout/string/string.hpp(218): note: see reference to class template instantiation 'sprout::detail::basic_string_impl<T,10,Traits>' being compiled
with
[
T=char,
Traits=sprout::char_traits
]
D:\Sprout\src\testspr../libs/string/test/string.cpp(22): note: see reference to class template instantiation 'sprout::basic_string<char,10,sprout::char_traits>' being compiled
with
[
T=char
]
.\sprout/functional/hash/hash.hpp(34): note: see reference to class template instantiation 'sprout::hash' being compiled
with
[
T=sprout::array<int,10>
]
D:\Sprout\src\testspr../libs/array/test/array.cpp(175): note: see reference to class template instantiation 'sprout::hash<const sprout::array<int,10>>' being compiled
.\sprout/algorithm/detail/min.hpp(29): note: see reference to class template instantiation 'sprout::less' being compiled
with
[
T=int
]
.\sprout/algorithm/lexicographical_compare.hpp(50): note: see reference to function template instantiation 'const T &sprout::min(const T &,const T &)' being compiled
with
[
T=int
]
.\sprout/algorithm/lexicographical_compare.hpp(98): note: see reference to function template instantiation 'bool sprout::detail::lexicographical_compare<InputIterator1,InputIterator2,Compare>(RandomAccessIterator1,RandomAccessIterator1,RandomAccessIterator2,RandomAccessIterator2,Compare,std::random_access_iterator_tag *)' being compiled
with
[
InputIterator1=sprout::index_iterator<const sprout::array<int,10> &,true,sprout::subscript>,
InputIterator2=sprout::index_iterator<const sprout::array<int,10> &,true,sprout::subscript>,
Compare=sprout::less,
RandomAccessIterator1=sprout::index_iterator<const sprout::array<int,10> &,true,sprout::subscript>,
RandomAccessIterator2=sprout::index_iterator<const sprout::array<int,10> &,true,sprout::subscript>
]
.\sprout/algorithm/lexicographical_compare.hpp(111): note: see reference to function template instantiation 'bool sprout::lexicographical_compare<InputIterator1,InputIterator2,sprout::less>(InputIterator1,InputIterator1,InputIterator2,InputIterator2,Compare)' being compiled
with
[
InputIterator1=sprout::index_iterator<const sprout::array<int,10> &,true,sprout::subscript>,
InputIterator2=sprout::index_iterator<const sprout::array<int,10> &,true,sprout::subscript>,
Compare=sprout::less
]
.\sprout/array/comparison.hpp(39): note: see reference to function template instantiation 'bool sprout::lexicographical_compare<sprout::index_iterator<const sprout::array<int,10> &,true,sprout::subscript>,sprout::index_iterator<const sprout::array<int,10> &,true,sprout::subscript>>(InputIterator1,InputIterator1,InputIterator2,InputIterator2)' being compiled
with
[
InputIterator1=sprout::index_iterator<const sprout::array<int,10> &,true,sprout::subscript>,
InputIterator2=sprout::index_iterator<const sprout::array<int,10> &,true,sprout::subscript>
]
D:\Sprout\src\testspr../libs/array/test/array.cpp(143): note: see reference to function template instantiation 'bool sprout::operator <<int,10>(const sprout::array<int,10> &,const sprout::array<int,10> &)' being compiled
.\sprout/index_tuple/integer_n.hpp(27): note: see reference to class template instantiation 'sprout::integer_sequence<T,0,0,0,0,0,0,0,0,0,0>' being compiled
with
[
T=ptrdiff_t
]
.\sprout/index_tuple/integer_n.hpp(60): note: see reference to class template instantiation 'sprout::detail::integer_n_next_even<T,sprout::integer_sequence<T,0,0,0,0,0>>' being compiled
with
[
T=ptrdiff_t
]
.\sprout/index_tuple/enable_make_indexes.hpp(19): note: see reference to class template instantiation 'sprout::detail::integer_n_impl<T,0,10,void>' being compiled
with
[
T=ptrdiff_t
]
.\sprout/index_tuple/integer_n.hpp(77): note: see reference to class template instantiation 'sprout::enable_make_indexes<sprout::detail::integer_n_impl<T,0,10,void>>' being compiled
with
[
T=ptrdiff_t
]
.\sprout/index_tuple/index_n.hpp(23): note: see reference to class template instantiation 'sprout::detail::integer_n<ptrdiff_t,0,10>' being compiled
.\sprout/index_tuple/index_n.hpp(23): note: see reference to alias template instantiation 'sprout::integer_n<ptrdiff_t,0,10>' being compiled
.\sprout/array/array.hpp(96): note: see reference to alias template instantiation 'sprout::index_n<0,10>' being compiled
.\sprout/array/array.hpp(95): note: while compiling class template member function 'sprout::array<int,10> sprout::array<int,10>::fill(const int &) const'
.\sprout/array/array.hpp(102): note: see reference to function template instantiation 'sprout::array<int,10> sprout::array<int,10>::fill(const int &) const' being compiled
D:\Sprout\src\testspr../libs/array/test/array.cpp(20): note: see reference to class template instantiation 'sprout::array<int,10>' being compiled
.\sprout/tuple/tuple/has_sprout_get.hpp(49): error C2955: 'sprout::tuples::detail::has_sprout_get': use of class template requires template argument list
.\sprout/tuple/tuple/has_sprout_get.hpp(37): note: see declaration of 'sprout::tuples::detail::has_sprout_get'
[command took 91 seconds]

Visual Studio 2015およびVIsual Studio 2013 November CTP対応

sprout/config/compiler/visualc.hpp

で現状constexprnoexceptが無効化されていますが、noexceptはVIsual Studio 2013 November CTPから、C++11のconstexprはVisual Studio 2015から対応しているように思います。ついでにC++11の他の機能への対応をまとめると

  • Visual Studio 2015より対応
    • C++11constexpr
    • User-defined literals
    • Unicode string literals
  • VIsual Studio 2013 November CTPより対応
    • classのdefault指定
    • noexcept
  • VIsual Studio 2013 より対応
    • classのdelete指定
    • template aliases
    • Delegating constructors

なので

#define SPROUT_NO_CXX11_CONSTEXPR
#define SPROUT_NO_CXX11_DEFAULTED_FUNCTIONS
#define SPROUT_NO_CXX11_DELETED_FUNCTIONS
#if _MSC_FULL_VER < 170051025 || !defined(SPROUT_MSVC_ENABLE_2012_NOV_CTP)
#   define SPROUT_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
#endif
#define SPROUT_NO_CXX11_NOEXCEPT
#define SPROUT_NO_CXX11_TEMPLATE_ALIASES
#define SPROUT_NO_CXX11_USER_DEFINED_LITERALS
#define SPROUT_NO_CXX11_DELEGATING_CONSTRUCTORS
#define SPROUT_NO_CXX11_UNICODE_LITERALS

#if _MSC_VER < 1900
#define SPROUT_NO_CXX11_CONSTEXPR
#define SPROUT_NO_CXX11_USER_DEFINED_LITERALS
#define SPROUT_NO_CXX11_UNICODE_LITERALS
#endif //_MSC_VER < 1900

#if _MSC_FULL_VER < 180031101
#define SPROUT_NO_CXX11_DEFAULTED_FUNCTIONS
#define SPROUT_NO_CXX11_NOEXCEPT
#endif //_MSC_FULL_VER < 180031101

#if _MSC_VER < 1800
#define SPROUT_NO_CXX11_DELETED_FUNCTIONS
#define SPROUT_NO_CXX11_TEMPLATE_ALIASES
#define SPROUT_NO_CXX11_DELEGATING_CONSTRUCTORS
#endif //_MSC_VER < 1800

#if _MSC_FULL_VER < 170051025 || !defined(SPROUT_MSVC_ENABLE_2012_NOV_CTP)
#   define SPROUT_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
#endif
#define SPROUT_NO_CXX11_ATTRIBUTES

のほうが適当だと思うのですが、どうなんでしょうか?

stateful rand について

以下のコードについて、

#include <sprout/stateful/rand.hpp>
template<int r=0>
struct C{
    typedef typename C<(r,sprout::rand())>::type type;
};

typedef typename C<>::type start;
int main (){}

クラスCのインスタンスが数十回実体化されるのを期待していたのですが、gcc5.1.0ではフリーズ、clang 3.5 では1回しか実体化されませんでした。これはバグなのでしょうか。

pow wrong???

Building with Clang 9.0.1 on Manjaro Linux, I'm getting the result that
sprout::pow(8, 4) is equal to 4095 instead of 4096. Am I dumb, or is there a problem here?

Ok, just tried it with gcc 9.2.0 and it gives the right answer. (4096). Spooky.

Error building in archlinux 64 bit with gcc 6.3

Hi I have an error (see below) building sprout with gcc6.3 on archlinux 64 bit:
(out of source build)
[derkalt@Arch64 Sprout]$ cmake -G "Unix Makefiles" ../../lib/Sprout
-- The C compiler identification is Clang 3.9.1
-- The CXX compiler identification is Clang 3.9.1
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Boost version: 1.63.0
-- Checking for module 'opencv'
-- Found opencv, version 3.2.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/derkalt/build/Sprout
[derkalt@Arch64 Sprout]$ make
Scanning dependencies of target libs_algorithm_test_upper_bound
[ 0%] Building CXX object libs/algorithm/test/CMakeFiles/libs_algorithm_test_upper_bound.dir/upper_bound.cpp.o
In file included from /home/derkalt/lib/Sprout/libs/algorithm/test/upper_bound.cpp:12:
In file included from /home/derkalt/lib/Sprout/sprout/array.hpp:14:
In file included from /home/derkalt/lib/Sprout/sprout/array/hash.hpp:15:
In file included from /home/derkalt/lib/Sprout/sprout/functional/hash.hpp:13:
In file included from /home/derkalt/lib/Sprout/sprout/functional/hash/hash_value.hpp:17:
In file included from /home/derkalt/lib/Sprout/sprout/functional/hash/detail/hash_float.hpp:15:
In file included from /home/derkalt/lib/Sprout/sprout/math/fpclassify.hpp:19:
/home/derkalt/lib/Sprout/sprout/math/issubnormal.hpp:44:3: error: expected ')'
issubnormal(FloatType x) {
^
/usr/include/math.h:415:41: note: expanded from macro 'issubnormal'

define issubnormal(x) (fpclassify (x) == FP_SUBNORMAL)

                                    ^

/home/derkalt/lib/Sprout/sprout/math/issubnormal.hpp:44:3: note: to match this '('
/usr/include/math.h:415:25: note: expanded from macro 'issubnormal'

define issubnormal(x) (fpclassify (x) == FP_SUBNORMAL)

                    ^

In file included from /home/derkalt/lib/Sprout/libs/algorithm/test/upper_bound.cpp:12:
In file included from /home/derkalt/lib/Sprout/sprout/array.hpp:14:
In file included from /home/derkalt/lib/Sprout/sprout/array/hash.hpp:15:
In file included from /home/derkalt/lib/Sprout/sprout/functional/hash.hpp:13:
In file included from /home/derkalt/lib/Sprout/sprout/functional/hash/hash_value.hpp:17:
In file included from /home/derkalt/lib/Sprout/sprout/functional/hash/detail/hash_float.hpp:15:
In file included from /home/derkalt/lib/Sprout/sprout/math/fpclassify.hpp:19:
/home/derkalt/lib/Sprout/sprout/math/issubnormal.hpp:52:22: error: no member named 'issubnormal' in
namespace 'sprout::math'
using sprout::math::issubnormal;
~~~~~~~~~~~~~~^
2 errors generated.
make[2]: *** [libs/algorithm/test/CMakeFiles/libs_algorithm_test_upper_bound.dir/build.make:63: libs/algorithm/test/CMakeFiles/libs_algorithm_test_upper_bound.dir/upper_bound.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:632: libs/algorithm/test/CMakeFiles/libs_algorithm_test_upper_bound.dir/all] Error 2
make: *** [Makefile:139: all] Error 2
[derkalt@Arch64 Sprout]$ ^C
[derkalt@Arch64 Sprout]$

st1, lst2という名前はWindows.hのinclude によって、マクロ汚染される

例えばWindwos.hとsprout::binary_searchを併用する場合にコンパイルエラーになります。

#undef lst1
#undef lst2

とすれば解決しますが、これはsprout側で対処するべき問題か、個々ユーザーで対応するべきか分からなかったので投げました。

VS2015 update 1のコンパイルエラー

c:\lib\sprout\sprout\iterator\merge_iterator.hpp(54): error C2143: 構文エラー: ')' が '定数' の前にありません。
  c:\lib\sprout\sprout\iterator\merge_iterator.hpp(186): note: コンパイル対象のクラス テンプレート インスタンス化 'sprout::merge_iterator<LIterator,RIterator,Compare>' のリファレンスを確認してください
c:\lib\sprout\sprout\iterator\merge_iterator.hpp(54): error C2143: 構文エラー: ';' が '定数' の前にありません。
c:\lib\sprout\sprout\iterator\merge_iterator.hpp(54): error C2059: 構文エラー: '定数'
c:\lib\sprout\sprout\iterator\merge_iterator.hpp(57): error C2059: 構文エラー: ')'
c:\lib\sprout\sprout\iterator\merge_iterator.hpp(58): error C2334: '{' の前に予期しないトークンがありました。関数の本体は無視されます
c:\lib\sprout\sprout\iterator\merge_iterator.hpp(65): error C2059: 構文エラー: '定数'
c:\lib\sprout\sprout\iterator\merge_iterator.hpp(65): error C2238: ';' の前に無効なトークンがあります。
c:\lib\sprout\sprout\iterator\merge_iterator.hpp(67): error C2059: 構文エラー: '定数'
c:\lib\sprout\sprout\iterator\merge_iterator.hpp(67): error C2238: ';' の前に無効なトークンがあります。
c:\lib\sprout\sprout\iterator\merge_iterator.hpp(76): error C2143: 構文エラー: ')' が '定数' の前にありません。
c:\lib\sprout\sprout\iterator\merge_iterator.hpp(76): error C2143: 構文エラー: ';' が '定数' の前にありません。
c:\lib\sprout\sprout\iterator\merge_iterator.hpp(75): error C2059: 構文エラー: '定数'
c:\lib\sprout\sprout\iterator\merge_iterator.hpp(75): error C2059: 構文エラー: ')'
c:\lib\sprout\sprout\iterator\merge_iterator.hpp(75): error C2334: ':' の前に予期しないトークンがありました。関数の本体は無視されます
c:\lib\sprout\sprout\iterator\merge_iterator.hpp(20): fatal error C1075: 左側の 中かっこ '{' に対応するものがファイルの最後まで検出されませんでした。

Visual Studio 2015 Clag with Microsoft CodeGen (January 2016) のエラー

  In file included from source\weapon.cpp:4:
  In file included from C:\lib\Sprout\sprout/algorithm.hpp:13:
  In file included from C:\lib\Sprout\sprout/algorithm/modifying.hpp:12:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed.hpp:49:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed/merge.hpp:16:
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(54,37): error : expected ')'
                          iterator_type it1, iterator_type lst1,
                                                           ^
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\dlgs.h(154,21) :  note: expanded from macro 'lst1'
  #define lst1        0x0460
                      ^
  C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(53,45) :  note: to match this '('
                  static SPROUT_CONSTEXPR bool check_in_left(
                                                            ^
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(65,17): error : expected member name or ';' after declaration specifiers
                  iterator_type lst1;
                  ~~~~~~~~~~~~~ ^
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\dlgs.h(154,21) :  note: expanded from macro 'lst1'
  #define lst1        0x0460
                      ^
  In file included from source\weapon.cpp:4:
  In file included from C:\lib\Sprout\sprout/algorithm.hpp:13:
  In file included from C:\lib\Sprout\sprout/algorithm/modifying.hpp:12:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed.hpp:49:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed/merge.hpp:16:
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(67,18): error : expected member name or ';' after declaration specifiers
                  iterator2_type lst2;
                  ~~~~~~~~~~~~~~ ^
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\dlgs.h(155,21) :  note: expanded from macro 'lst2'
  #define lst2        0x0461
                      ^
  In file included from source\weapon.cpp:4:
  In file included from C:\lib\Sprout\sprout/algorithm.hpp:13:
  In file included from C:\lib\Sprout\sprout/algorithm/modifying.hpp:12:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed.hpp:49:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed/merge.hpp:16:
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(72,18): error : expected '(' or '{'
                          : current1(), lst1(), current2(), lst2(), comp(), in_left(true)
                                        ^
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\dlgs.h(154,21) :  note: expanded from macro 'lst1'
  #define lst1        0x0460
                      ^
  In file included from source\weapon.cpp:4:
  In file included from C:\lib\Sprout\sprout/algorithm.hpp:13:
  In file included from C:\lib\Sprout\sprout/algorithm/modifying.hpp:12:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed.hpp:49:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed/merge.hpp:16:
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(76,37): error : expected ')'
                          iterator_type it1, iterator_type lst1,
                                                           ^
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\dlgs.h(154,21) :  note: expanded from macro 'lst1'
  #define lst1        0x0460
                      ^
  C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(75,34) :  note: to match this '('
                  SPROUT_CONSTEXPR merge_iterator(
                                                 ^
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(80,21): error : expected '(' or '{'
                          : current1(it1), lst1(lst1)
                                           ^
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\dlgs.h(154,21) :  note: expanded from macro 'lst1'
  #define lst1        0x0460
                      ^
  In file included from source\weapon.cpp:4:
  In file included from C:\lib\Sprout\sprout/algorithm.hpp:13:
  In file included from C:\lib\Sprout\sprout/algorithm/modifying.hpp:12:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed.hpp:49:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed/merge.hpp:16:
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(87,27): error : expected '(' or '{'
                          : current1(it.base()), lst1(it.last1())
                                                 ^
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\dlgs.h(154,21) :  note: expanded from macro 'lst1'
  #define lst1        0x0460
                      ^
  In file included from source\weapon.cpp:4:
  In file included from C:\lib\Sprout\sprout/algorithm.hpp:13:
  In file included from C:\lib\Sprout\sprout/algorithm/modifying.hpp:12:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed.hpp:49:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed/merge.hpp:16:
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(172,53): error : expected unqualified-id
                          && SPROUT_NOEXCEPT_EXPR(sprout::swap(lst1, other.lst1))
                                                                           ^
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\dlgs.h(154,21) :  note: expanded from macro 'lst1'
  #define lst1        0x0460
                      ^
  C:\lib\Sprout\sprout/config/suffix.hpp(170,47) :  note: expanded from macro 'SPROUT_NOEXCEPT_EXPR'
  #       define SPROUT_NOEXCEPT_EXPR(EXPR) noexcept((EXPR))
                                                      ^
  C:\lib\Sprout\sprout/config/suffix.hpp(169,45) :  note: expanded from macro 'SPROUT_NOEXCEPT_IF'
  #       define SPROUT_NOEXCEPT_IF(COND) noexcept((COND))
                                                    ^
  In file included from source\weapon.cpp:4:
  In file included from C:\lib\Sprout\sprout/algorithm.hpp:13:
  In file included from C:\lib\Sprout\sprout/algorithm/modifying.hpp:12:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed.hpp:49:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed/merge.hpp:16:
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(174,53): error : expected unqualified-id
                          && SPROUT_NOEXCEPT_EXPR(sprout::swap(lst2, other.lst2))
                                                                           ^
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\dlgs.h(155,21) :  note: expanded from macro 'lst2'
  #define lst2        0x0461
                      ^
  C:\lib\Sprout\sprout/config/suffix.hpp(170,47) :  note: expanded from macro 'SPROUT_NOEXCEPT_EXPR'
  #       define SPROUT_NOEXCEPT_EXPR(EXPR) noexcept((EXPR))
                                                      ^
  C:\lib\Sprout\sprout/config/suffix.hpp(169,45) :  note: expanded from macro 'SPROUT_NOEXCEPT_IF'
  #       define SPROUT_NOEXCEPT_IF(COND) noexcept((COND))
                                                    ^
  In file included from source\weapon.cpp:4:
  In file included from C:\lib\Sprout\sprout/algorithm.hpp:13:
  In file included from C:\lib\Sprout\sprout/algorithm/modifying.hpp:12:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed.hpp:49:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed/merge.hpp:16:
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(59,26): error : use of undeclared identifier 'it2'; did you mean 'it1'?
                          return it1 != lst1 ? (it2 != lst2 ? !comp(*it2, *it1) : true)
                                                ^~~
                                                it1
  C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(54,18) :  note: 'it1' declared here
                          iterator_type it1, iterator_type lst1,
                                        ^
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(59,41): error : invalid use of member 'comp' in static member function
                          return it1 != lst1 ? (it2 != lst2 ? !comp(*it2, *it1) : true)
                                                               ^~~~
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(59,47): error : use of undeclared identifier 'it2'; did you mean 'it1'?
                          return it1 != lst1 ? (it2 != lst2 ? !comp(*it2, *it1) : true)
                                                                     ^~~
                                                                     it1
  C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(54,18) :  note: 'it1' declared here
                          iterator_type it1, iterator_type lst1,
                                        ^
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(60,9): error : use of undeclared identifier 'it2'; did you mean 'it1'?
                                  : !(it2 != lst2)
                                      ^~~
                                      it1
  C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(54,18) :  note: 'it1' declared here
                          iterator_type it1, iterator_type lst1,
                                        ^
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(53,32): error : no return statement in constexpr function
                  static SPROUT_CONSTEXPR bool check_in_left(
                                               ^
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(180,29): error : expected unqualified-id
                          sprout::swap(lst1, other.lst1);
                                                   ^
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\dlgs.h(154,21) :  note: expanded from macro 'lst1'
  #define lst1        0x0460
                      ^
  In file included from source\weapon.cpp:4:
  In file included from C:\lib\Sprout\sprout/algorithm.hpp:13:
  In file included from C:\lib\Sprout\sprout/algorithm/modifying.hpp:12:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed.hpp:49:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed/merge.hpp:16:
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(182,29): error : expected unqualified-id
                          sprout::swap(lst2, other.lst2);
                                                   ^
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\dlgs.h(155,21) :  note: expanded from macro 'lst2'
  #define lst2        0x0461
                      ^
  In file included from source\weapon.cpp:4:
  In file included from C:\lib\Sprout\sprout/algorithm.hpp:13:
  In file included from C:\lib\Sprout\sprout/algorithm/modifying.hpp:12:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed.hpp:49:
  In file included from C:\lib\Sprout\sprout/algorithm/fixed/merge.hpp:16:
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(216,47): error : expected ')'
          make_merge_iterator(LIterator it1, LIterator lst1, RIterator it2, RIterator lst2, Compare comp) {
                                                       ^
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\dlgs.h(154,21) :  note: expanded from macro 'lst1'
  #define lst1        0x0460
                      ^
  C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(216,21) :  note: to match this '('
          make_merge_iterator(LIterator it1, LIterator lst1, RIterator it2, RIterator lst2, Compare comp) {
                             ^
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(217,75): error : use of undeclared identifier 'it2'; did you mean 'it1'?
                  return sprout::merge_iterator<LIterator, RIterator, Compare>(it1, lst1, it2, lst2, comp);
                                                                                          ^~~
                                                                                          it1
  C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(216,32) :  note: 'it1' declared here
          make_merge_iterator(LIterator it1, LIterator lst1, RIterator it2, RIterator lst2, Compare comp) {
                                        ^
C:\lib\Sprout\sprout/iterator/merge_iterator.hpp(217,86): error : use of undeclared identifier 'comp'
                  return sprout::merge_iterator<LIterator, RIterator, Compare>(it1, lst1, it2, lst2, comp);
                                                                                                     ^
CLANGCOMPILE : fatal error : too many errors emitted, stopping now [-ferror-limit=]
  20 errors generated.

sprout::is_convert_constructible_v causes compilation error

Following code:

include <sprout/type.hpp>

int main() {}

Clang3.4 says:
In file included from prog.cc:1:
In file included from /usr/local/sprout/sprout/type.hpp:14:
In file included from /usr/local/sprout/sprout/type/integral_array.hpp:16:
In file included from /usr/local/sprout/sprout/tuple/tuple/get.hpp:16:
In file included from /usr/local/sprout/sprout/tuple/tuple/tuple.hpp:14:
In file included from /usr/local/sprout/sprout/tuple/tuple/tuple_decl.hpp:24:
/usr/local/sprout/sprout/type_traits/is_convert_constructible.hpp:36:68: error: too few template arguments for class template 'is_convert_constructible'
SPROUT_STATIC_CONSTEXPR bool is_convert_constructible_v = sprout::is_convert_constructible::value;
^
/usr/local/sprout/sprout/type_traits/is_convert_constructible.hpp:30:9: note: template is declared here
struct is_convert_constructible
^
1 error generated.

static_visitor を継承していない Visitor でも apply_visitor に渡したい

apply_visitor に渡す Visitor が static_visitor を継承してなくても( result_type が定義されていなくても)動作すると嬉しい。

// 動作イメージ
struct twice{
    template<typename T>
    constexpr T
    operator ()(T t) const{
        return t + t;
    }
};

typedef sprout::variant<int, float> var_type;

constexpr var_type var1{ 5 };
static_assert(sprout::apply_visitor(twice{}, var1) == 10, "");

constexpr var_type var2{ 1.25f };
static_assert(sprout::apply_visitor(twice{}, var2) == 2.5f, "");

とりあえず、
https://github.com/bolero-MURAKAMI/Sprout/blob/master/sprout/variant/apply_visitor.hpp#L9

https://github.com/bolero-MURAKAMI/Sprout/blob/master/sprout/variant/variant.hpp#L252
は decltype を使った後置宣言で回避出きそうなんですが、
https://github.com/bolero-MURAKAMI/Sprout/blob/master/sprout/variant/variant.hpp#L130
ここで result_type のコンストラクタを呼び出して返しているのをどうするべきかなーと。

と、ここまで考えて思ったんですが、static_visitor って apply_visitor 以外にも必要なケースってあるんですかね。

sprout::io does not work with clang

sprout::io does not work with clang.
But It may be clang's bug.(because it works with gcc)
If someone has a workaround idea, please apply it.

Following code:

#include <sprout/io.hpp>
int main() {
    constexpr auto test = sprout::io::output<32>(sprout::io::root << "test");
}

Output:

Start

prog.cc:4:20: error: constexpr variable 'test' must be initialized by a constant expression
constexpr auto test = sprout::io::output<32>(sprout::io::root << "test");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/sprout/sprout/utility/value_holder/value_holder.hpp:269:28: note: read of temporary whose lifetime has ended
return helper_type::ref(holder_);
^
/usr/local/sprout/sprout/io.hpp:452:12: note: in call to '&sprout::io::leaf_expression<char [5]>(rhs).value_->operator char const (&)5'
return value_;
^
/usr/local/sprout/sprout/io.hpp:652:7: note: in call to '&sprout::io::leaf_expression<char [5]>(rhs)->value()'
>(expr.right().value(), expr.settings());
^
/usr/local/sprout/sprout/io.hpp:679:11: note: in call to 'get_leaf(sprout::io::root << "test")'
return sprout::io::detail::get_leaf(expr);
^
/usr/local/sprout/sprout/io.hpp:784:32: note: in call to 'get_leaf(sprout::io::root << "test")'
sprout::io::eval<Elem, N>(sprout::io::get_leaf(expr))...
^
/usr/local/sprout/sprout/io.hpp:794:11: note: in call to 'output(sprout::io::root << "test", {})'
return sprout::io::detail::output<Elem, N>(
^
prog.cc:4:27: note: in call to 'output(sprout::io::root << "test")'
constexpr auto test = sprout::io::output<32>(sprout::io::root << "test");
^
/usr/local/sprout/sprout/io.hpp:558:11: note: temporary created here
>(lhs, sprout::io::leaf_expression(rhs));
^
1 error generated.

1

Finish

Wandbox:
http://melpon.org/wandbox/permlink/0JcuLqvwMbuIf7Bj

fit:: 版のアルゴリズムが、ForwardIterator を要求する

現在の実装の都合上、二度走査する必要があるので ForwardIterator でなければならない。
現状、 ForwardIterator 未満の場合は static_assert で殺している。
InputIterator でよくするためには、fixed:: 版とは別の実装を用意する必要があり面倒。

InputIterator を要求するアルゴリズムの多くが、ForwardIterator を要求する実装になっていた

sprout/algorithm/fixed/copy.hpp より
sprout::fixed::detail::copy_impl(sprout::next(first), last, result, size, args..., *first)

【問題】
sprout::next(first) と *first のどちらが先に評価されるかは処理系依存であり、
もしイテレータのインクリメント後に以前のイテレータをデリファレンスするならば、ForwardIterator でなければならない。
そのため、InputIterator に対してこの実装は不適切である。

【対策】
InputIterator を要求するアルゴリズムについて、
デリファレンスが先に行われるよう、実装を変更しなければならない。

なお、non-modifying なアルゴリズムの実装にはこの種の問題は無いと思われる。

Visual Studio2015Update1でリンカーエラー

何かしらのヘッダーでsprout/math.hppを読み込みそれを複数のcppでincludeするとLNK2005がでます。
YSRKEN/KanColleSimulator_KAI@3a1191a
で確認しました。
なお、Clang with Microsoft CodeGen (January 2016) では問題は発生しません。

1>------ ビルド開始: プロジェクト:KCS_CUI, 構成:Debug x64 ------
1>  fleet.cpp
1>  コードを生成中...
1>  コンパイル中...
1>  weapon.cpp
1>  simulator.cpp
1>  other.cpp
1>  main.cpp
1>  kammusu.cpp
1>  コードを生成中...
1>kammusu.obj : error LNK2005: "public: static class sprout::array<float,33> const sprout::math::detail::bernoulli_numbers<float>::table" (?table@?$bernoulli_numbers@M@detail@math@sprout@@2V?$array@M$0CB@@4@B) は既に fleet.obj で定義されています。
1>kammusu.obj : error LNK2005: "public: static class sprout::array<double,51> const sprout::math::detail::bernoulli_numbers<double>::table" (?table@?$bernoulli_numbers@N@detail@math@sprout@@2V?$array@N$0DD@@4@B) は既に fleet.obj で定義されています。
1>kammusu.obj : error LNK2005: "public: static class sprout::array<long double,51> const sprout::math::detail::bernoulli_numbers<long double>::table" (?table@?$bernoulli_numbers@O@detail@math@sprout@@2V?$array@O$0DD@@4@B) は既に fleet.obj で定義されています。
1>main.obj : error LNK2005: "public: static class sprout::array<float,33> const sprout::math::detail::bernoulli_numbers<float>::table" (?table@?$bernoulli_numbers@M@detail@math@sprout@@2V?$array@M$0CB@@4@B) は既に fleet.obj で定義されています。
1>main.obj : error LNK2005: "public: static class sprout::array<double,51> const sprout::math::detail::bernoulli_numbers<double>::table" (?table@?$bernoulli_numbers@N@detail@math@sprout@@2V?$array@N$0DD@@4@B) は既に fleet.obj で定義されています。
1>main.obj : error LNK2005: "public: static class sprout::array<long double,51> const sprout::math::detail::bernoulli_numbers<long double>::table" (?table@?$bernoulli_numbers@O@detail@math@sprout@@2V?$array@O$0DD@@4@B) は既に fleet.obj で定義されています。
1>other.obj : error LNK2005: "public: static class sprout::array<float,33> const sprout::math::detail::bernoulli_numbers<float>::table" (?table@?$bernoulli_numbers@M@detail@math@sprout@@2V?$array@M$0CB@@4@B) は既に fleet.obj で定義されています。
1>other.obj : error LNK2005: "public: static class sprout::array<double,51> const sprout::math::detail::bernoulli_numbers<double>::table" (?table@?$bernoulli_numbers@N@detail@math@sprout@@2V?$array@N$0DD@@4@B) は既に fleet.obj で定義されています。
1>other.obj : error LNK2005: "public: static class sprout::array<long double,51> const sprout::math::detail::bernoulli_numbers<long double>::table" (?table@?$bernoulli_numbers@O@detail@math@sprout@@2V?$array@O$0DD@@4@B) は既に fleet.obj で定義されています。
1>simulator.obj : error LNK2005: "public: static class sprout::array<long double,51> const sprout::math::detail::bernoulli_numbers<long double>::table" (?table@?$bernoulli_numbers@O@detail@math@sprout@@2V?$array@O$0DD@@4@B) は既に fleet.obj で定義されています。
1>simulator.obj : error LNK2005: "public: static class sprout::array<float,33> const sprout::math::detail::bernoulli_numbers<float>::table" (?table@?$bernoulli_numbers@M@detail@math@sprout@@2V?$array@M$0CB@@4@B) は既に fleet.obj で定義されています。
1>simulator.obj : error LNK2005: "public: static class sprout::array<double,51> const sprout::math::detail::bernoulli_numbers<double>::table" (?table@?$bernoulli_numbers@N@detail@math@sprout@@2V?$array@N$0DD@@4@B) は既に fleet.obj で定義されています。
1>weapon.obj : error LNK2005: "public: static class sprout::array<float,33> const sprout::math::detail::bernoulli_numbers<float>::table" (?table@?$bernoulli_numbers@M@detail@math@sprout@@2V?$array@M$0CB@@4@B) は既に fleet.obj で定義されています。
1>weapon.obj : error LNK2005: "public: static class sprout::array<double,51> const sprout::math::detail::bernoulli_numbers<double>::table" (?table@?$bernoulli_numbers@N@detail@math@sprout@@2V?$array@N$0DD@@4@B) は既に fleet.obj で定義されています。
1>weapon.obj : error LNK2005: "public: static class sprout::array<long double,51> const sprout::math::detail::bernoulli_numbers<long double>::table" (?table@?$bernoulli_numbers@O@detail@math@sprout@@2V?$array@O$0DD@@4@B) は既に fleet.obj で定義されています。
1>C:\Users\j.pierreno\Documents\git\KanColleSimulator_KAI\KCS_CUI\x64\Debug\KCS_CUI.exe : fatal error LNK1169: 1 つ以上の複数回定義されているシンボルが見つかりました。
========== ビルド: 0 正常終了、1 失敗、0 更新不要、0 スキップ ==========

sizeof(variant<T...>) > sizeof(tuple<T...>)?

https://github.com/bolero-MURAKAMI/Sprout/blob/master/sprout/variant/variant.hpp

shows, on lines 81 and then on lines 52 and 40 that the size of the variant<T...> is
sizeof(int)+sizeof(tuple<T...>. That seems a waste of space to me since other
variants, such as this one:

https://github.com/ericniebler/range-v3/blob/master/include/range/v3/utility/variant.hpp

and the existing boost one:

http://www.boost.org/doc/libs/1_58_0/doc/html/variant.html

make the size close to max of the sizeof(T)...

Why wasn't a similar space saving designed used for sprout's variant?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.