mirror of
https://github.com/boostorg/typeof.git
synced 2025-06-25 12:01:34 +02:00
Compare commits
89 Commits
svn-branch
...
boost-1.65
Author | SHA1 | Date | |
---|---|---|---|
be4cdd3a29 | |||
733e1e94c8 | |||
2b4df4f09f | |||
12e1fe615a | |||
681499bba4 | |||
7db26fbf83 | |||
64ad04d3eb | |||
72e3e5ac18 | |||
ec9d092345 | |||
ab7073f32d | |||
03ae4b3465 | |||
1d3589e9c0 | |||
d8b8af69ac | |||
4994d5be13 | |||
ed7d30939d | |||
c394d0a5ae | |||
6aea11f3df | |||
5bbb552f28 | |||
5bf1a089bd | |||
4e34737b9c | |||
8092dd0003 | |||
9fcf6ff70e | |||
2334bc2bf7 | |||
e56adea1b1 | |||
731e9ce0ad | |||
4fab1b5d17 | |||
85eed8ff60 | |||
81e54ccb1f | |||
e9749f185f | |||
b46f8efd6b | |||
c75b62533a | |||
d04dc539a0 | |||
1468636543 | |||
468e0de51e | |||
dcb1e95d25 | |||
bfb19140f1 | |||
3892d59ff8 | |||
eff78826d2 | |||
b420583f9c | |||
4aab62e71c | |||
9a5663ff14 | |||
0f21fe555a | |||
a70cd7396a | |||
c10804f3b0 | |||
ef283a6a74 | |||
4c9b8ba961 | |||
33ae5341c1 | |||
b7bfcbef45 | |||
2d046d3f9f | |||
f2a646b417 | |||
7d3afd076d | |||
cde21a588d | |||
6926249653 | |||
3ecb3bf102 | |||
1c1ab4c883 | |||
9aa58de5e2 | |||
8d8d35c1ae | |||
84ec781ea1 | |||
f7df17a93a | |||
ed21868c25 | |||
c66289f7ac | |||
43b4d4522c | |||
8868adc891 | |||
452b493b7a | |||
eeff4e592c | |||
1b65bfc95d | |||
eda5c4afba | |||
340148f738 | |||
64ba3be86f | |||
d337b0837a | |||
dddbb00da4 | |||
935b36d8f5 | |||
5bd010787a | |||
55ac93f947 | |||
366ab1b621 | |||
aede9c2866 | |||
2b92bbcb21 | |||
dff8a5c505 | |||
a460694e5d | |||
db9203fb0e | |||
9a14e20bc5 | |||
47a4b2a2c1 | |||
337fe1fdf6 | |||
11b18afcce | |||
7cbdf2406a | |||
97b9bda347 | |||
041f9cfd24 | |||
c17f725e5f | |||
35874c8e32 |
327
.travis.yml
Normal file
327
.travis.yml
Normal file
@ -0,0 +1,327 @@
|
||||
# Copyright 2016, 2017 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
|
||||
language: cpp
|
||||
|
||||
sudo: false
|
||||
|
||||
python: "2.7"
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- BOGUS_JOB=true
|
||||
|
||||
matrix:
|
||||
|
||||
exclude:
|
||||
- env: BOGUS_JOB=true
|
||||
|
||||
include:
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++ CXXSTD=c++03
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.9
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.9
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-5
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-5
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-5
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++03
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++11
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.5
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.5
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.5
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.5
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.6
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.6
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.7
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.7
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++14
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.9
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.9
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.9
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.9
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++14
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.9
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.9
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.9
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.9
|
||||
|
||||
- os: osx
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++03
|
||||
|
||||
- os: osx
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++11
|
||||
|
||||
- os: osx
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14
|
||||
|
||||
- os: osx
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++1z
|
||||
|
||||
install:
|
||||
- cd ..
|
||||
- git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
- cd boost-root
|
||||
- git submodule update --init tools/build
|
||||
- git submodule update --init libs/config
|
||||
- git submodule update --init tools/boostdep
|
||||
- cp -r $TRAVIS_BUILD_DIR/* libs/typeof
|
||||
- python tools/boostdep/depinst/depinst.py typeof
|
||||
- ./bootstrap.sh
|
||||
- ./b2 headers
|
||||
|
||||
script:
|
||||
- |-
|
||||
echo "using $TOOLSET : : $COMPILER : <cxxflags>-std=$CXXSTD ;" > ~/user-config.jam
|
||||
- ./b2 libs/typeof/test toolset=$TOOLSET
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: always
|
@ -10,11 +10,20 @@ boostbook standalone
|
||||
:
|
||||
typeof
|
||||
:
|
||||
<xsl:param>boost.root=../../../..
|
||||
<xsl:param>nav.layout=none
|
||||
<xsl:param>navig.graphics=0
|
||||
;
|
||||
|
||||
install html : ../../../doc/html/boostbook.css ;
|
||||
install html : ../../../doc/src/boostbook.css ;
|
||||
install ../ : ../../../boost.png ;
|
||||
|
||||
|
||||
###############################################################################
|
||||
alias boostdoc
|
||||
: typeof
|
||||
:
|
||||
:
|
||||
: ;
|
||||
explicit boostdoc ;
|
||||
alias boostrelease ;
|
||||
explicit boostrelease ;
|
||||
|
@ -1,4 +1,4 @@
|
||||
[library Boost.Typeof
|
||||
[library Boost.Typeof
|
||||
[authors [Vertleyb, Arkadiy], [Holt, Peder]]
|
||||
[copyright 2004 2005 Arkadiy Vertleyb, Peder Holt]
|
||||
[license
|
||||
@ -383,6 +383,14 @@ Redefine if you want the Typeof Library to handle functions with more parameters
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:messages MESSAGES]
|
||||
|
||||
Define `BOOST_TYPEOF_MESSAGE` before including boost/typeof/typeof.hpp to
|
||||
include messages "using typeof emulation" and "using native typeof".
|
||||
By default, these messages will not be displayed.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:limit_size LIMIT_SIZE]
|
||||
|
||||
The `BOOST_TYPEOF_LIMIT_SIZE` macro defines the size of the compile-time sequence
|
||||
|
34
include/boost/typeof/decltype.hpp
Normal file
34
include/boost/typeof/decltype.hpp
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright (C) 2006 Arkadiy Vertleyb
|
||||
// Copyright (C) 2017 Daniela Engert
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_DECLTYPE_HPP_INCLUDED
|
||||
# define BOOST_TYPEOF_DECLTYPE_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
template<typename T>
|
||||
using remove_cv_ref_t = typename remove_cv<typename remove_reference<T>::type>::type;
|
||||
}}
|
||||
|
||||
#define BOOST_TYPEOF(expr) boost::type_of::remove_cv_ref_t<decltype(expr)>
|
||||
#define BOOST_TYPEOF_TPL BOOST_TYPEOF
|
||||
|
||||
#define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) \
|
||||
struct name {\
|
||||
typedef BOOST_TYPEOF_TPL(expr) type;\
|
||||
};
|
||||
|
||||
#define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \
|
||||
struct name {\
|
||||
typedef BOOST_TYPEOF(expr) type;\
|
||||
};
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TYPE(x)
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE(x, params)
|
||||
|
||||
#endif //BOOST_TYPEOF_DECLTYPE_HPP_INCLUDED
|
||||
|
2
include/boost/typeof/message.hpp
Executable file → Normal file
2
include/boost/typeof/message.hpp
Executable file → Normal file
@ -2,7 +2,7 @@
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(_MSC_VER) && !defined BOOST_TYPEOF_SILENT
|
||||
#if defined(_MSC_VER) && defined BOOST_TYPEOF_MESSAGES
|
||||
# pragma message(BOOST_TYPEOF_TEXT)
|
||||
#endif
|
||||
#undef BOOST_TYPEOF_TEXT
|
||||
|
91
include/boost/typeof/msvc/typeof_impl.hpp
Executable file → Normal file
91
include/boost/typeof/msvc/typeof_impl.hpp
Executable file → Normal file
@ -15,9 +15,7 @@
|
||||
# include <boost/type_traits/is_function.hpp>
|
||||
# include <boost/utility/enable_if.hpp>
|
||||
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC,>=1310)
|
||||
# include <typeinfo>
|
||||
# endif
|
||||
# include <typeinfo>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -25,7 +23,7 @@ namespace boost
|
||||
{
|
||||
|
||||
//Compile time constant code
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC,>=1300) && defined(_MSC_EXTENSIONS)
|
||||
# if defined(_MSC_EXTENSIONS)
|
||||
template<int N> struct the_counter;
|
||||
|
||||
template<typename T,int N = 5/*for similarity*/>
|
||||
@ -85,26 +83,7 @@ namespace boost
|
||||
|
||||
//Typeof code
|
||||
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC,==1300)
|
||||
template<typename ID>
|
||||
struct msvc_extract_type
|
||||
{
|
||||
template<bool>
|
||||
struct id2type_impl;
|
||||
|
||||
typedef id2type_impl<true> id2type;
|
||||
};
|
||||
|
||||
template<typename T, typename ID>
|
||||
struct msvc_register_type : msvc_extract_type<ID>
|
||||
{
|
||||
template<>
|
||||
struct id2type_impl<true> //VC7.0 specific bugfeature
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
};
|
||||
#elif BOOST_WORKAROUND(BOOST_MSVC,==1400)
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC,>=1400)
|
||||
struct msvc_extract_type_default_param {};
|
||||
|
||||
template<typename ID, typename T = msvc_extract_type_default_param>
|
||||
@ -153,57 +132,7 @@ namespace boost
|
||||
};
|
||||
};
|
||||
# endif
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC,>=1310)
|
||||
template<const std::type_info& ref_type_info>
|
||||
struct msvc_typeid_wrapper {
|
||||
typedef typename msvc_extract_type<msvc_typeid_wrapper>::id2type id2type;
|
||||
typedef typename id2type::type wrapped_type;
|
||||
typedef typename wrapped_type::type type;
|
||||
};
|
||||
//This class is used for registering the type T. encode_type<T> is mapped against typeid(encode_type<T>).
|
||||
//msvc_typeid_wrapper<typeid(encode_type<T>)> will now have a type typedef that equals encode_type<T>.
|
||||
template<typename T>
|
||||
struct encode_type
|
||||
{
|
||||
typedef encode_type<T> input_type;
|
||||
//Invoke registration of encode_type<T>. typeid(encode_type<T>) is now mapped to encode_type<T>. Do not use registered_type for anything.
|
||||
//The reason for registering encode_type<T> rather than T, is that VC handles typeid(function reference) poorly. By adding another
|
||||
//level of indirection, we solve this problem.
|
||||
typedef typename msvc_register_type<input_type,msvc_typeid_wrapper<typeid(input_type)> >::id2type registered_type;
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<typename T> typename disable_if<
|
||||
typename is_function<T>::type,
|
||||
typename encode_type<T>::input_type>::type encode_start(T const&);
|
||||
|
||||
template<typename T> typename enable_if<
|
||||
typename is_function<T>::type,
|
||||
typename encode_type<T>::input_type>::type encode_start(T&);
|
||||
|
||||
template<typename Organizer, typename T>
|
||||
msvc_register_type<T,Organizer> typeof_register_type(const T&);
|
||||
|
||||
# define BOOST_TYPEOF(expr) \
|
||||
boost::type_of::msvc_typeid_wrapper<typeid(boost::type_of::encode_start(expr))>::type
|
||||
|
||||
# define BOOST_TYPEOF_TPL(expr) typename BOOST_TYPEOF(expr)
|
||||
|
||||
# define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) \
|
||||
struct name {\
|
||||
enum {_typeof_register_value=sizeof(typeid(boost::type_of::typeof_register_type<name>(expr)))};\
|
||||
typedef typename boost::type_of::msvc_extract_type<name>::id2type id2type;\
|
||||
typedef typename id2type::type type;\
|
||||
};
|
||||
|
||||
# define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \
|
||||
struct name {\
|
||||
enum {_typeof_register_value=sizeof(typeid(boost::type_of::typeof_register_type<name>(expr)))};\
|
||||
typedef boost::type_of::msvc_extract_type<name>::id2type id2type;\
|
||||
typedef id2type::type type;\
|
||||
};
|
||||
|
||||
# else
|
||||
template<int ID>
|
||||
struct msvc_typeid_wrapper {
|
||||
typedef typename msvc_extract_type<mpl::int_<ID> >::id2type id2type;
|
||||
@ -239,10 +168,13 @@ struct name {\
|
||||
{
|
||||
typedef char(*type)[encode_type<T>::value];
|
||||
};
|
||||
template<typename T> typename disable_if<
|
||||
typename is_function<T>::type,
|
||||
typename sizer<T>::type>::type encode_start(T const&);
|
||||
|
||||
template<typename T>
|
||||
typename sizer<T>::type encode_start(T const&);
|
||||
|
||||
template<typename T> typename enable_if<
|
||||
typename is_function<T>::type,
|
||||
typename sizer<T>::type>::type encode_start(T&);
|
||||
template<typename Organizer, typename T>
|
||||
msvc_register_type<T,Organizer> typeof_register_type(const T&,Organizer* =0);
|
||||
|
||||
@ -253,19 +185,18 @@ struct name {\
|
||||
|
||||
# define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) \
|
||||
struct name {\
|
||||
BOOST_STATIC_CONSTANT(int,_typeof_register_value=sizeof(boost::type_of::typeof_register_type<name>(expr)));\
|
||||
enum {_typeof_register_value=sizeof(boost::type_of::typeof_register_type<name>(expr))};\
|
||||
typedef typename boost::type_of::msvc_extract_type<name>::id2type id2type;\
|
||||
typedef typename id2type::type type;\
|
||||
};
|
||||
|
||||
# define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \
|
||||
struct name {\
|
||||
BOOST_STATIC_CONSTANT(int,_typeof_register_value=sizeof(boost::type_of::typeof_register_type<name>(expr)));\
|
||||
enum {_typeof_register_value=sizeof(boost::type_of::typeof_register_type<name>(expr))};\
|
||||
typedef boost::type_of::msvc_extract_type<name>::id2type id2type;\
|
||||
typedef id2type::type type;\
|
||||
};
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
0
include/boost/typeof/native.hpp
Executable file → Normal file
0
include/boost/typeof/native.hpp
Executable file → Normal file
19
include/boost/typeof/register_functions.hpp
Executable file → Normal file
19
include/boost/typeof/register_functions.hpp
Executable file → Normal file
@ -24,12 +24,19 @@
|
||||
enum
|
||||
{
|
||||
FUN_ID = BOOST_TYPEOF_UNIQUE_ID(),
|
||||
FUN_PTR_ID = FUN_ID + 1 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
FUN_REF_ID = FUN_ID + 2 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
MEM_FUN_ID = FUN_ID + 3 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
CONST_MEM_FUN_ID = FUN_ID + 4 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
VOLATILE_MEM_FUN_ID = FUN_ID + 5 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
VOLATILE_CONST_MEM_FUN_ID = FUN_ID + 6 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY)
|
||||
FUN_PTR_ID = FUN_ID + 1 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
FUN_REF_ID = FUN_ID + 2 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
MEM_FUN_ID = FUN_ID + 3 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
CONST_MEM_FUN_ID = FUN_ID + 4 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
VOLATILE_MEM_FUN_ID = FUN_ID + 5 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
VOLATILE_CONST_MEM_FUN_ID = FUN_ID + 6 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
FUN_VAR_ID = FUN_ID + 7 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
FUN_VAR_PTR_ID = FUN_ID + 8 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
FUN_VAR_REF_ID = FUN_ID + 9 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
MEM_FUN_VAR_ID = FUN_ID + 10 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
CONST_MEM_FUN_VAR_ID = FUN_ID + 11 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
VOLATILE_MEM_FUN_VAR_ID = FUN_ID + 12 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY),
|
||||
VOLATILE_CONST_MEM_FUN_VAR_ID = FUN_ID + 13 * BOOST_PP_INC(BOOST_TYPEOF_LIMIT_FUNCTION_ARITY)
|
||||
};
|
||||
|
||||
BOOST_TYPEOF_BEGIN_ENCODE_NS
|
||||
|
48
include/boost/typeof/register_functions_iterate.hpp
Executable file → Normal file
48
include/boost/typeof/register_functions_iterate.hpp
Executable file → Normal file
@ -15,6 +15,13 @@ struct encode_type_impl<V, R(*)(BOOST_PP_ENUM_PARAMS(n, P))>
|
||||
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_PTR_ID + n) type;
|
||||
};
|
||||
|
||||
template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
|
||||
struct encode_type_impl<V, R(*)(BOOST_PP_ENUM_PARAMS(n, P) ...)>
|
||||
{
|
||||
typedef R BOOST_PP_CAT(P, n);
|
||||
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_VAR_PTR_ID + n) type;
|
||||
};
|
||||
|
||||
template<class Iter>
|
||||
struct decode_type_impl<boost::mpl::size_t<FUN_PTR_ID + n>, Iter>
|
||||
{
|
||||
@ -24,6 +31,15 @@ struct decode_type_impl<boost::mpl::size_t<FUN_PTR_ID + n>, Iter>
|
||||
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
|
||||
};
|
||||
|
||||
template<class Iter>
|
||||
struct decode_type_impl<boost::mpl::size_t<FUN_VAR_PTR_ID + n>, Iter>
|
||||
{
|
||||
typedef Iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
|
||||
typedef BOOST_PP_CAT(p, n)(*type)(BOOST_PP_ENUM_PARAMS(n, p) ...);
|
||||
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
|
||||
};
|
||||
|
||||
#ifndef BOOST_TYPEOF_NO_FUNCTION_TYPES
|
||||
|
||||
// function references
|
||||
@ -35,6 +51,13 @@ struct decode_type_impl<boost::mpl::size_t<FUN_PTR_ID + n>, Iter>
|
||||
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_REF_ID + n) type;
|
||||
};
|
||||
|
||||
template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
|
||||
struct encode_type_impl<V, R(&)(BOOST_PP_ENUM_PARAMS(n, P) ...)>
|
||||
{
|
||||
typedef R BOOST_PP_CAT(P, n);
|
||||
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_VAR_REF_ID + n) type;
|
||||
};
|
||||
|
||||
template<class Iter>
|
||||
struct decode_type_impl<boost::mpl::size_t<FUN_REF_ID + n>, Iter>
|
||||
{
|
||||
@ -44,6 +67,15 @@ struct decode_type_impl<boost::mpl::size_t<FUN_PTR_ID + n>, Iter>
|
||||
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
|
||||
};
|
||||
|
||||
template<class Iter>
|
||||
struct decode_type_impl<boost::mpl::size_t<FUN_VAR_REF_ID + n>, Iter>
|
||||
{
|
||||
typedef Iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
|
||||
typedef BOOST_PP_CAT(p, n)(&type)(BOOST_PP_ENUM_PARAMS(n, p) ...);
|
||||
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
|
||||
};
|
||||
|
||||
// functions
|
||||
|
||||
template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
|
||||
@ -53,6 +85,13 @@ struct decode_type_impl<boost::mpl::size_t<FUN_PTR_ID + n>, Iter>
|
||||
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_ID + n) type;
|
||||
};
|
||||
|
||||
template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
|
||||
struct encode_type_impl<V, R(BOOST_PP_ENUM_PARAMS(n, P) ...)>
|
||||
{
|
||||
typedef R BOOST_PP_CAT(P, n);
|
||||
typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_VAR_ID + n) type;
|
||||
};
|
||||
|
||||
template<class Iter>
|
||||
struct decode_type_impl<boost::mpl::size_t<FUN_ID + n>, Iter>
|
||||
{
|
||||
@ -62,6 +101,15 @@ struct decode_type_impl<boost::mpl::size_t<FUN_PTR_ID + n>, Iter>
|
||||
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
|
||||
};
|
||||
|
||||
template<class Iter>
|
||||
struct decode_type_impl<boost::mpl::size_t<FUN_VAR_ID + n>, Iter>
|
||||
{
|
||||
typedef Iter iter0;
|
||||
BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
|
||||
typedef BOOST_PP_CAT(p, n)(type)(BOOST_PP_ENUM_PARAMS(n, p) ...);
|
||||
typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
|
||||
};
|
||||
|
||||
#endif//BOOST_TYPEOF_NO_FUNCTION_TYPES
|
||||
|
||||
#ifndef BOOST_TYPEOF_NO_MEMBER_FUNCTION_TYPES
|
||||
|
3
include/boost/typeof/register_fundamental.hpp
Executable file → Normal file
3
include/boost/typeof/register_fundamental.hpp
Executable file → Normal file
@ -34,8 +34,7 @@ BOOST_TYPEOF_REGISTER_TYPE(long double)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(wchar_t)
|
||||
#endif
|
||||
|
||||
#if (defined(BOOST_MSVC) && (BOOST_MSVC == 1200)) \
|
||||
|| (defined(BOOST_INTEL_CXX_VERSION) && defined(_MSC_VER) && (BOOST_INTEL_CXX_VERSION <= 600)) \
|
||||
#if (defined(BOOST_INTEL_CXX_VERSION) && defined(_MSC_VER) && (BOOST_INTEL_CXX_VERSION <= 600)) \
|
||||
|| (defined(__BORLANDC__) && (__BORLANDC__ == 0x600) && (_MSC_VER == 1200))
|
||||
BOOST_TYPEOF_REGISTER_TYPE(unsigned __int8)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(__int8)
|
||||
|
94
include/boost/typeof/typeof.hpp
Executable file → Normal file
94
include/boost/typeof/typeof.hpp
Executable file → Normal file
@ -13,9 +13,17 @@
|
||||
# error both typeof emulation and native mode requested
|
||||
#endif
|
||||
|
||||
#if defined(__COMO__)
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !defined(BOOST_TYPEOF_EMULATION)
|
||||
# define BOOST_TYPEOF_DECLTYPE
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
|
||||
#elif defined(__COMO__)
|
||||
# ifdef __GNUG__
|
||||
# ifndef(BOOST_TYPEOF_EMULATION)
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
@ -49,7 +57,7 @@
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
@ -65,7 +73,7 @@
|
||||
# endif
|
||||
# define BOOST_TYPEOF_KEYWORD __typeof__
|
||||
# else
|
||||
# error typeof emulation is not supported
|
||||
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
|
||||
# endif
|
||||
# else // 9.x
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
@ -75,7 +83,22 @@
|
||||
# define BOOST_TYPEOF_KEYWORD __typeof__
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#elif defined __CODEGEARC__
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
|
||||
# endif
|
||||
# else
|
||||
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
|
||||
# endif
|
||||
#elif defined __BORLANDC__
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
|
||||
# endif
|
||||
# else
|
||||
# define BOOST_TYPEOF_EMULATION_UNSUPPORTED
|
||||
# endif
|
||||
#elif defined __DMC__
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
@ -85,34 +108,21 @@
|
||||
# define MSVC_TYPEOF_HACK
|
||||
# endif
|
||||
#elif defined(_MSC_VER)
|
||||
# if (_MSC_VER <= 1300) // 6.5, 7.0
|
||||
# if (_MSC_VER >= 1310) // 7.1 ->
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# ifndef _MSC_EXTENSIONS
|
||||
# define BOOST_TYPEOF_EMULATION
|
||||
# else
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
# endif
|
||||
# include <boost/typeof/msvc/typeof_impl.hpp>
|
||||
# define MSVC_TYPEOF_HACK
|
||||
# else
|
||||
# error typeof emulation is not supported
|
||||
# endif
|
||||
# elif (_MSC_VER >= 1310) // 7.1, 8.0
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
# ifdef BOOST_TYPEOF_NATIVE
|
||||
# include <boost/typeof/msvc/typeof_impl.hpp>
|
||||
# define MSVC_TYPEOF_HACK
|
||||
# endif
|
||||
/*# else // 8.0
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# define BOOST_TYPEOF_EMULATION
|
||||
# endif
|
||||
# else
|
||||
# error native typeof is not supported
|
||||
# endif*/
|
||||
# endif
|
||||
|
||||
#elif defined(__HP_aCC)
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
@ -143,7 +153,29 @@
|
||||
# else
|
||||
# error native typeof is not supported
|
||||
# endif
|
||||
|
||||
#elif defined(__SUNPRO_CC)
|
||||
# if (__SUNPRO_CC < 0x590 )
|
||||
# ifdef BOOST_TYPEOF_NATIVE
|
||||
# error native typeof is not supported
|
||||
# endif
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# define BOOST_TYPEOF_EMULATION
|
||||
# endif
|
||||
# else
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
# define BOOST_TYPEOF_KEYWORD __typeof__
|
||||
# endif
|
||||
# endif
|
||||
#elif defined(__IBM__TYPEOF__)
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# define BOOST_TYPEOF_NATIVE
|
||||
# endif
|
||||
# define BOOST_TYPEOF_KEYWORD __typeof__
|
||||
# endif
|
||||
#else //unknown compiler
|
||||
# ifndef BOOST_TYPEOF_NATIVE
|
||||
# ifndef BOOST_TYPEOF_EMULATION
|
||||
@ -163,7 +195,9 @@
|
||||
#define BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()\
|
||||
<boost/typeof/incr_registration_group.hpp>
|
||||
|
||||
#ifdef BOOST_TYPEOF_EMULATION
|
||||
#ifdef BOOST_TYPEOF_EMULATION_UNSUPPORTED
|
||||
# include <boost/typeof/unsupported.hpp>
|
||||
#elif defined BOOST_TYPEOF_EMULATION
|
||||
# define BOOST_TYPEOF_TEXT "using typeof emulation"
|
||||
# include <boost/typeof/message.hpp>
|
||||
# include <boost/typeof/typeof_impl.hpp>
|
||||
@ -177,7 +211,11 @@
|
||||
#elif defined(BOOST_TYPEOF_NATIVE)
|
||||
# define BOOST_TYPEOF_TEXT "using native typeof"
|
||||
# include <boost/typeof/message.hpp>
|
||||
# include <boost/typeof/native.hpp>
|
||||
# ifdef BOOST_TYPEOF_DECLTYPE
|
||||
# include <boost/typeof/decltype.hpp>
|
||||
# else
|
||||
# include <boost/typeof/native.hpp>
|
||||
# endif
|
||||
#else
|
||||
# error typeof configuration error
|
||||
#endif
|
||||
|
29
include/boost/typeof/unsupported.hpp
Normal file
29
include/boost/typeof/unsupported.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2010 Peder Holt
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_TYPEOF_UNSUPPORTED_HPP_INCLUDED
|
||||
#define BOOST_TYPEOF_UNSUPPORTED_HPP_INCLUDED
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
struct typeof_emulation_is_unsupported_on_this_compiler {};
|
||||
}}
|
||||
|
||||
#define BOOST_TYPEOF(expr) boost::type_of::typeof_emulation_is_unsupported_on_this_compiler
|
||||
#define BOOST_TYPEOF_TPL BOOST_TYPEOF
|
||||
|
||||
#define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) \
|
||||
struct name {\
|
||||
typedef BOOST_TYPEOF_TPL(expr) type;\
|
||||
};
|
||||
|
||||
#define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \
|
||||
struct name {\
|
||||
typedef BOOST_TYPEOF(expr) type;\
|
||||
};
|
||||
|
||||
|
||||
#define BOOST_TYPEOF_REGISTER_TYPE(x)
|
||||
#define BOOST_TYPEOF_REGISTER_TEMPLATE(x, params)
|
||||
|
||||
#endif
|
2
index.html
Executable file → Normal file
2
index.html
Executable file → Normal file
@ -10,7 +10,7 @@ License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
|
||||
</head>
|
||||
<body>
|
||||
Automatic redirection failed, please go to
|
||||
<a href="../../doc/html/xpressive.html">../../doc/html/typeof.html</a>
|
||||
<a href="../../doc/html/typeof.html">../../doc/html/typeof.html</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
16
meta/libraries.json
Normal file
16
meta/libraries.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"key": "typeof",
|
||||
"name": "Typeof",
|
||||
"authors": [
|
||||
"Arkadiy Vertleyb",
|
||||
"Peder Holt"
|
||||
],
|
||||
"description": "Typeof operator emulation.",
|
||||
"category": [
|
||||
"Emulation"
|
||||
],
|
||||
"maintainers": [
|
||||
"Arkadiy Vertleyb <vertleyb -at- hotmail.com>",
|
||||
"Peder Holt <peder.holt -at- gmail.com>"
|
||||
]
|
||||
}
|
2
test/function.cpp
Executable file → Normal file
2
test/function.cpp
Executable file → Normal file
@ -6,3 +6,5 @@
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<void()>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<double(bool)>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<void(...)>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<float(int, ...)>::value);
|
||||
|
16
test/function_binding.cpp
Executable file → Normal file
16
test/function_binding.cpp
Executable file → Normal file
@ -7,8 +7,16 @@
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
int foo(double);
|
||||
typedef int(&FREF)(double);
|
||||
FREF fref = *foo;
|
||||
int foo1(double);
|
||||
int foo2(...);
|
||||
int foo3(int, ...);
|
||||
typedef int(&FREF1)(double);
|
||||
typedef int(&FREF2)(...);
|
||||
typedef int(&FREF3)(int, ...);
|
||||
FREF1 fref1 = *foo1;
|
||||
FREF2 fref2 = *foo2;
|
||||
FREF3 fref3 = *foo3;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(fref), int(double)>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(fref1), int(double)>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(fref2), int(...)>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(fref3), int(int,...)>::value));
|
||||
|
17
test/function_ptr.cpp
Executable file → Normal file
17
test/function_ptr.cpp
Executable file → Normal file
@ -8,12 +8,19 @@ BOOST_STATIC_ASSERT(boost::type_of::test<double(*)()>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<double(*)(int, double, short, char*, bool, char, float, long, unsigned short)>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<void(*)()>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<void(*)(int, double, short, char*, bool, char, float, long, unsigned short)>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<void(*)(...)>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<void(*)(int, double, short, char*, bool, char, float, long, unsigned short, ...)>::value);
|
||||
|
||||
// check that const gets stripped from function pointer
|
||||
|
||||
int foo(double);
|
||||
typedef int(*PTR)(double);
|
||||
typedef const PTR CPTR;
|
||||
CPTR cptr = foo;
|
||||
int foo1(double);
|
||||
int foo2(...);
|
||||
typedef int(*PTR1)(double);
|
||||
typedef int(*PTR2)(...);
|
||||
typedef const PTR1 CPTR1;
|
||||
typedef const PTR2 CPTR2;
|
||||
CPTR1 cptr1 = foo1;
|
||||
CPTR2 cptr2 = foo2;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(cptr), PTR>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(cptr1), PTR1>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(cptr2), PTR2>::value));
|
||||
|
20
test/function_ptr_from_tpl.cpp
Executable file → Normal file
20
test/function_ptr_from_tpl.cpp
Executable file → Normal file
@ -6,15 +6,23 @@
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
void f()
|
||||
{}
|
||||
void f1() {}
|
||||
void f2(...) {}
|
||||
|
||||
template<class T>
|
||||
struct tpl
|
||||
struct tpl1
|
||||
{
|
||||
typedef BOOST_TYPEOF_TPL(&f) type;
|
||||
typedef BOOST_TYPEOF_TPL(&f1) type;
|
||||
};
|
||||
|
||||
typedef void(*fun_type)();
|
||||
template<class T>
|
||||
struct tpl2
|
||||
{
|
||||
typedef BOOST_TYPEOF_TPL(&f2) type;
|
||||
};
|
||||
|
||||
typedef void(*fun1_type)();
|
||||
typedef void(*fun2_type)(...);
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<tpl<void>::type, fun_type>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<tpl1<void>::type, fun1_type>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<tpl2<void>::type, fun2_type>::value));
|
||||
|
2
test/function_ref.cpp
Executable file → Normal file
2
test/function_ref.cpp
Executable file → Normal file
@ -6,3 +6,5 @@
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<void(&)()>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<int(&)(int, short)>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<int(&)(...)>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<int(&)(int,...)>::value);
|
||||
|
@ -1,7 +1,7 @@
|
||||
# // (C) Copyright Tobias Schwinger
|
||||
# //
|
||||
# // Use modification and distribution are subject to the boost Software License
|
||||
# // Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt).
|
||||
# // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
|
||||
|
||||
# // Preprocess and run this script.
|
||||
# //
|
||||
|
Reference in New Issue
Block a user