Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boost 1.84 Pre-Release with Boost 1.84.0 Additions #99

Merged
merged 2 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions inst/include/boost/qvm.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef BOOST_QVM_HPP_INCLUDED
#define BOOST_QVM_HPP_INCLUDED

// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc.

// 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)

#include <boost/qvm/all.hpp>

#endif
7 changes: 7 additions & 0 deletions inst/include/boost/qvm/all.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc.

// 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)

#include <boost/qvm/lite.hpp>
#include <boost/qvm/swizzle.hpp>
94 changes: 94 additions & 0 deletions inst/include/boost/qvm/deduce_quat.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#ifndef BOOST_QVM_DEDUCE_QUAT_HPP_INCLUDED
#define BOOST_QVM_DEDUCE_QUAT_HPP_INCLUDED

// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc.

// 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)

#include <boost/qvm/deduce_scalar.hpp>
#include <boost/qvm/quat_traits.hpp>
#include <boost/qvm/static_assert.hpp>

namespace boost { namespace qvm {

template <class T>
struct quat;

namespace
qvm_detail
{
template <class Q,class S,
class QS=typename quat_traits<Q>::scalar_type>
struct
deduce_q_default
{
BOOST_QVM_STATIC_ASSERT(is_quat<Q>::value);
typedef quat<typename quat_traits<Q>::scalar_type> type;
};

template <class Q,class S>
struct
deduce_q_default<Q,S,S>
{
BOOST_QVM_STATIC_ASSERT(is_quat<Q>::value);
typedef Q type;
};
}

template <class Q,class S=typename quat_traits<Q>::scalar_type>
struct
deduce_quat
{
BOOST_QVM_STATIC_ASSERT(is_quat<Q>::value);
typedef typename qvm_detail::deduce_q_default<Q,S>::type type;
};

namespace
qvm_detail
{
template <class A,class B,class S,
bool IsScalarA=is_scalar<A>::value,
bool IsScalarB=is_scalar<B>::value>
struct
deduce_q2_default
{
typedef quat<S> type;
};

template <class Q,class S>
struct
deduce_q2_default<Q,Q,S,false,false>
{
BOOST_QVM_STATIC_ASSERT(is_quat<Q>::value);
typedef Q type;
};

template <class A,class B,class S>
struct
deduce_q2_default<A,B,S,false,true>
{
BOOST_QVM_STATIC_ASSERT(is_quat<A>::value);
typedef typename deduce_quat<A,S>::type type;
};

template <class A,class B,class S>
struct
deduce_q2_default<A,B,S,true,false>
{
BOOST_QVM_STATIC_ASSERT(is_quat<B>::value);
typedef typename deduce_quat<B,S>::type type;
};
}

template <class A,class B,class S=typename deduce_scalar<typename scalar<A>::type,typename scalar<B>::type>::type>
struct
deduce_quat2
{
BOOST_QVM_STATIC_ASSERT(is_quat<A>::value || is_quat<B>::value);
typedef typename qvm_detail::deduce_q2_default<A,B,S>::type type;
};

} }

#endif
31 changes: 31 additions & 0 deletions inst/include/boost/qvm/detail/quat_assign.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#ifndef BOOST_QVM_DETAIL_QUAT_ASSIGN_HPP_INCLUDED
#define BOOST_QVM_DETAIL_QUAT_ASSIGN_HPP_INCLUDED

// Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc.

// 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)

#include <boost/qvm/config.hpp>
#include <boost/qvm/enable_if.hpp>
#include <boost/qvm/quat_traits.hpp>

namespace boost { namespace qvm {

template <class A,class B>
BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_OPERATIONS
typename enable_if_c<
is_quat<A>::value && is_quat<B>::value,
A &>::type
assign( A & a, B const & b )
{
write_quat_element<0>(a,quat_traits<B>::template read_element<0>(b));
write_quat_element<1>(a,quat_traits<B>::template read_element<1>(b));
write_quat_element<2>(a,quat_traits<B>::template read_element<2>(b));
write_quat_element<3>(a,quat_traits<B>::template read_element<3>(b));
return a;
}

} }

#endif
Loading