Skip to content
This repository has been archived by the owner on Mar 21, 2023. It is now read-only.

Commit

Permalink
Updated version and copyright year, some improvements in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
erythronelumbo committed Apr 25, 2021
1 parent a3c969c commit e5d63a4
Show file tree
Hide file tree
Showing 98 changed files with 1,584 additions and 1,571 deletions.
42 changes: 21 additions & 21 deletions include/cynodelic/mulinum/add.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019 Álvaro Ceballos
// Copyright (c) 2021 Álvaro Ceballos
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt

Expand Down Expand Up @@ -39,13 +39,13 @@ struct add_impl {};
*/
template <
typename IntType,
IntType ValueL,IntType ValueR
IntType ValueL, IntType ValueR
>
struct add_impl<
integer_c<IntType,ValueL>,
integer_c<IntType,ValueR>
integer_c<IntType, ValueL>,
integer_c<IntType, ValueR>
> :
integer_c<IntType,ValueL + ValueR>
integer_c<IntType, ValueL + ValueR>
{};


Expand All @@ -54,30 +54,30 @@ struct add_impl<
*/
template <
typename IntType,
IntType ValueL,IntType ValueR,
IntType ValueL, IntType ValueR,
typename... Others
>
struct add_impl<
integer_c<IntType,ValueL>,
integer_c<IntType,ValueR>,
integer_c<IntType, ValueL>,
integer_c<IntType, ValueR>,
Others...
> :
add_impl<integer_c<IntType,ValueL + ValueR>,Others...>
add_impl<integer_c<IntType, ValueL + ValueR>, Others...>
{};


/**
* @brief Helper for `add`.
*/
template <
std::intmax_t LhsNum,std::intmax_t LhsDen,
std::intmax_t RhsNum,std::intmax_t RhsDen
std::intmax_t LhsNum, std::intmax_t LhsDen,
std::intmax_t RhsNum, std::intmax_t RhsDen
>
struct add_impl<rational<LhsNum,LhsDen>,rational<RhsNum,RhsDen>> :
struct add_impl<rational<LhsNum, LhsDen>, rational<RhsNum, RhsDen>> :
simplified_form<
rational<
rational<LhsNum,LhsDen>::num*rational<RhsNum,RhsDen>::den + rational<RhsNum,RhsDen>::num*rational<LhsNum,LhsDen>::den,
rational<LhsNum,LhsDen>::den*rational<RhsNum,RhsDen>::den
rational<LhsNum, LhsDen>::num*rational<RhsNum, RhsDen>::den + rational<RhsNum, RhsDen>::num*rational<LhsNum, LhsDen>::den,
rational<LhsNum, LhsDen>::den*rational<RhsNum, RhsDen>::den
>
>
{};
Expand All @@ -87,16 +87,16 @@ struct add_impl<rational<LhsNum,LhsDen>,rational<RhsNum,RhsDen>> :
* @brief Helper for `add`.
*/
template <
std::intmax_t LhsNum,std::intmax_t LhsDen,
std::intmax_t RhsNum,std::intmax_t RhsDen,
std::intmax_t LhsNum, std::intmax_t LhsDen,
std::intmax_t RhsNum, std::intmax_t RhsDen,
typename... Others
>
struct add_impl<rational<LhsNum,LhsDen>,rational<RhsNum,RhsDen>,Others...> :
struct add_impl<rational<LhsNum, LhsDen>, rational<RhsNum, RhsDen>,Others...> :
add_impl<
simplified_form<
rational<
rational<LhsNum,LhsDen>::num*rational<RhsNum,RhsDen>::den + rational<RhsNum,RhsDen>::num*rational<LhsNum,LhsDen>::den,
rational<LhsNum,LhsDen>::den*rational<RhsNum,RhsDen>::den
rational<LhsNum, LhsDen>::num*rational<RhsNum, RhsDen>::den + rational<RhsNum, RhsDen>::num*rational<LhsNum, LhsDen>::den,
rational<LhsNum, LhsDen>::den*rational<RhsNum, RhsDen>::den
>
>,
Others...
Expand All @@ -110,9 +110,9 @@ struct add_impl<rational<LhsNum,LhsDen>,rational<RhsNum,RhsDen>,Others...> :
* @ingroup arithmeticops
* @brief Addition.
*
* Performs addition of arithmetic types of the same type.
* Performs addition of at least two arithmetic types of the same type.
*
* @param ArithmeticTypes... All the types.
* @param ArithmeticTypes... Arithmetic types to sum.
*/
template <typename... ArithmeticTypes>
using add = typename add_impl<ArithmeticTypes...>::type;
Expand Down
14 changes: 7 additions & 7 deletions include/cynodelic/mulinum/apply.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019 Álvaro Ceballos
// Copyright (c) 2021 Álvaro Ceballos
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt

Expand All @@ -25,17 +25,17 @@ namespace cynodelic { namespace mulinum {
/**
* @brief Helper for `apply`.
*/
template <template <typename...> class,typename>
template <template <typename...> class, typename>
struct apply_impl {};


/**
* @brief Helper for `apply`.
*/
template <template <typename...> class MetaFn,typename FirstArg,typename... Others>
struct apply_impl<MetaFn,vector<FirstArg,Others...>>
template <template <typename...> class MetaFn, typename FirstArg, typename... Others>
struct apply_impl<MetaFn, vector<FirstArg, Others...>>
{
using type = MetaFn<FirstArg,Others...>;
using type = MetaFn<FirstArg, Others...>;
};

#endif // DOXYGEN_SHOULD_SKIP_THIS
Expand All @@ -50,8 +50,8 @@ struct apply_impl<MetaFn,vector<FirstArg,Others...>>
* @param MetaFn The metafunction.
* @param ArgsVector A @ref vector containing the arguments for `MetaFn`.
*/
template <template <typename...> class MetaFn,typename ArgsVector>
using apply = typename apply_impl<MetaFn,ArgsVector>::type;
template <template <typename...> class MetaFn, typename ArgsVector>
using apply = typename apply_impl<MetaFn, ArgsVector>::type;


}} // end of "cynodelic::mulinum" namespace
Expand Down
6 changes: 3 additions & 3 deletions include/cynodelic/mulinum/arg.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019 Álvaro Ceballos
// Copyright (c) 2021 Álvaro Ceballos
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt

Expand Down Expand Up @@ -35,7 +35,7 @@ namespace cynodelic { namespace mulinum {
template <std::size_t ArgNum>
struct arg
{
template <typename FirstArg,typename... Others>
template <typename FirstArg, typename... Others>
struct apply
{
using type = typename arg<(ArgNum - 1)>::template apply<Others...>::type;
Expand All @@ -53,7 +53,7 @@ struct arg
template <>
struct arg<0>
{
template <typename FirstArg,typename... Others>
template <typename FirstArg, typename... Others>
struct apply
{
using type = FirstArg;
Expand Down
18 changes: 9 additions & 9 deletions include/cynodelic/mulinum/arithmetic_traits.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019 Álvaro Ceballos
// Copyright (c) 2021 Álvaro Ceballos
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt

Expand Down Expand Up @@ -36,15 +36,15 @@ struct is_arithmetic_type_impl : false_ {};
/**
* @brief Helper for `is_arithmetic_type`.
*/
template <typename IntType,IntType Value>
struct is_arithmetic_type_impl<integer_c<IntType,Value>> : true_ {};
template <typename IntType, IntType Value>
struct is_arithmetic_type_impl<integer_c<IntType, Value>> : true_ {};


/**
* @brief Helper for `is_arithmetic_type`.
*/
template <std::intmax_t Num,std::intmax_t Den>
struct is_arithmetic_type_impl<rational<Num,Den>> : true_ {};
template <std::intmax_t Num, std::intmax_t Den>
struct is_arithmetic_type_impl<rational<Num, Den>> : true_ {};

#endif // DOXYGEN_SHOULD_SKIP_THIS

Expand All @@ -71,8 +71,8 @@ struct is_integer_c_impl : false_ {};
/**
* @brief Helper for `is_integer_c`.
*/
template <typename IntType,IntType Value>
struct is_integer_c_impl<integer_c<IntType,Value>> : true_ {};
template <typename IntType, IntType Value>
struct is_integer_c_impl<integer_c<IntType, Value>> : true_ {};

#endif // DOXYGEN_SHOULD_SKIP_THIS

Expand All @@ -99,8 +99,8 @@ struct is_rational_impl : false_ {};
/**
* @brief Helper for @ref is_rational.
*/
template <std::intmax_t Num,std::intmax_t Den>
struct is_rational_impl<rational<Num,Den>> : true_ {};
template <std::intmax_t Num, std::intmax_t Den>
struct is_rational_impl<rational<Num, Den>> : true_ {};

#endif // DOXYGEN_SHOULD_SKIP_THIS

Expand Down
6 changes: 3 additions & 3 deletions include/cynodelic/mulinum/arity_of.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019 Álvaro Ceballos
// Copyright (c) 2021 Álvaro Ceballos
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt

Expand Down Expand Up @@ -29,13 +29,13 @@ namespace cynodelic { namespace mulinum {
* Counts the arity (i.e. the number of arguments) of a metafunction/template
* type, returning a @ref size_c.
*
* NOTE: Since the instances of the underlying counting function are harcoded,
* @note Since the instances of the underlying counting function are harcoded,
* it supports template types up to 200 arguments.
*
* @param MetaFn The metafunction.
*/
template <template <typename...> class MetaFn>
struct arity_of : integer_c<std::size_t,detail::get_template_arity<MetaFn>()>
struct arity_of : integer_c<std::size_t, detail::get_template_arity<MetaFn>()>
{};


Expand Down
48 changes: 24 additions & 24 deletions include/cynodelic/mulinum/at.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019 Álvaro Ceballos
// Copyright (c) 2021 Álvaro Ceballos
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt

Expand Down Expand Up @@ -32,17 +32,17 @@ namespace cynodelic { namespace mulinum {
/**
* @brief Helper for `at`.
*/
template <typename,typename,bool>
template <typename, typename, bool>
struct at_impl {};


/**
* @brief Helper for `at`.
*/
template <typename... Items,std::size_t Idx,bool Dummy>
struct at_impl<vector<Items...>,size_c<Idx>,Dummy>
template <typename... Items, std::size_t Idx, bool Dummy>
struct at_impl<vector<Items...>, size_c<Idx>, Dummy>
{
using type = typename detail::vector_at<vector<Items...>,Idx>::type;
using type = typename detail::vector_at<vector<Items...>, Idx>::type;
};


Expand All @@ -54,9 +54,9 @@ template <
typename Tail,
std::size_t Idx
>
struct at_impl<list_node<HeadItem,Tail>,size_c<Idx>,false>
struct at_impl<list_node<HeadItem, Tail>, size_c<Idx>, false>
{
using type = typename at_impl<Tail,size_c<Idx - 1>,(Idx - 1) == 0>::type;
using type = typename at_impl<Tail, size_c<Idx - 1>, (Idx - 1) == 0>::type;
};


Expand All @@ -67,7 +67,7 @@ template <
typename HeadItem,
typename Tail
>
struct at_impl<list_node<HeadItem,Tail>,size_c<0>,true>
struct at_impl<list_node<HeadItem, Tail>, size_c<0>, true>
{
using type = HeadItem;
};
Expand All @@ -76,36 +76,36 @@ struct at_impl<list_node<HeadItem,Tail>,size_c<0>,true>
/**
* @brief Helper for `at`.
*/
template <char... Chars,std::size_t Idx,bool Dummy>
struct at_impl<string<Chars...>,size_c<Idx>,Dummy> :
integer_c<char,string<Chars...>::data[Idx]>
template <char... Chars, std::size_t Idx, bool Dummy>
struct at_impl<string<Chars...>, size_c<Idx>, Dummy> :
integer_c<char, string<Chars...>::data[Idx]>
{};


/**
* @brief Helper for `at`.
*/
template <typename IntType,IntType... Items,std::size_t Idx,bool Dummy>
struct at_impl<vector_c<IntType,Items...>,size_c<Idx>,Dummy> :
integer_c<IntType,vector_c<IntType,Items...>::data[Idx]>
template <typename IntType, IntType... Items, std::size_t Idx, bool Dummy>
struct at_impl<vector_c<IntType, Items...>, size_c<Idx>, Dummy> :
integer_c<IntType, vector_c<IntType, Items...>::data[Idx]>
{};


/**
* @brief Helper for `at`.
*/
template <typename IntType,IntType HeadItem,std::size_t Idx,typename Tail>
struct at_impl<list_node_c<IntType,HeadItem,Tail>,size_c<Idx>,false> :
integer_c<IntType,at_impl<Tail,size_c<Idx - 1>,(Idx - 1) == 0>::value>
template <typename IntType, IntType HeadItem, std::size_t Idx, typename Tail>
struct at_impl<list_node_c<IntType, HeadItem, Tail>, size_c<Idx>, false> :
integer_c<IntType, at_impl<Tail, size_c<Idx - 1>, (Idx - 1) == 0>::value>
{};


/**
* @brief Helper for `at`.
*/
template <typename IntType,IntType HeadItem,typename Tail>
struct at_impl<list_node_c<IntType,HeadItem,Tail>,size_c<0>,true> :
integer_c<IntType,HeadItem>
template <typename IntType, IntType HeadItem, typename Tail>
struct at_impl<list_node_c<IntType, HeadItem, Tail>, size_c<0>, true> :
integer_c<IntType, HeadItem>
{};

#endif // DOXYGEN_SHOULD_SKIP_THIS
Expand All @@ -122,8 +122,8 @@ struct at_impl<list_node_c<IntType,HeadItem,Tail>,size_c<0>,true> :
* @param Idx The position where the desired element is (a
* @ref size_c).
*/
template <typename TypeContainer,typename Idx>
using at = typename at_impl<TypeContainer,Idx,(Idx::value == 0)>::type;
template <typename TypeContainer, typename Idx>
using at = typename at_impl<TypeContainer, Idx, (Idx::value == 0)>::type;


/**
Expand All @@ -136,8 +136,8 @@ using at = typename at_impl<TypeContainer,Idx,(Idx::value == 0)>::type;
* @param TypeContainer The container.
* @param Idx The position where the desired element is.
*/
template <typename TypeContainer,std::size_t Idx>
using at_c = typename at_impl<TypeContainer,size_c<Idx>,(Idx == 0)>::type;
template <typename TypeContainer, std::size_t Idx>
using at_c = typename at_impl<TypeContainer, size_c<Idx>, (Idx == 0)>::type;


}} // end of "cynodelic::mulinum" namespace
Expand Down
2 changes: 1 addition & 1 deletion include/cynodelic/mulinum/bind.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019 Álvaro Ceballos
// Copyright (c) 2021 Álvaro Ceballos
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt

Expand Down
2 changes: 1 addition & 1 deletion include/cynodelic/mulinum/bind_fwd.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019 Álvaro Ceballos
// Copyright (c) 2021 Álvaro Ceballos
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt

Expand Down
Loading

0 comments on commit e5d63a4

Please sign in to comment.