Михаил Капелько 5 months ago
parent
commit
7735de9238
1 changed files with 4 additions and 16 deletions
  1. +4
    -16
      v4/any.h

+ 4
- 16
v4/any.h View File

@@ -8,15 +8,13 @@
* + http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4562.html#any
* + https://cplusplus.github.io/LWG/lwg-active.html#2509
*
* Copyright (c) 2016 Denilson das Merc?s Amorim
* Copyright (c) 2016 Denilson das Mercês Amorim
* Copyright (c) 2018 Claudio Fantacci
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE.md or copy at http://www.boost.org/LICENSE_1_0.txt)
*/

#include <iostream>

#ifndef ANY_H
#define ANY_H

@@ -469,10 +467,7 @@ template<typename ValueType>
inline ValueType any_cast(const any& operand)
{
auto p = any_cast<typename std::add_const<typename std::remove_reference<ValueType>::type>::type>(&operand);
if(p == nullptr) {
std::cout << "libany err-01\n";
throw bad_any_cast();
}
if(p == nullptr) throw bad_any_cast();
return *p;
}

@@ -484,11 +479,7 @@ template<typename ValueType>
inline ValueType any_cast(any& operand)
{
auto p = any_cast<typename std::remove_reference<ValueType>::type>(&operand);
if(p == nullptr) {
std::cout << "libany err-02\n";
throw bad_any_cast();
}

if(p == nullptr) throw bad_any_cast();
return *p;
}

@@ -515,10 +506,7 @@ inline ValueType any_cast(any&& operand)
#endif

auto p = any_cast<typename std::remove_reference<ValueType>::type>(&operand);
if(p == nullptr) {
std::cout << "libany err-03\n";
throw bad_any_cast();
}
if(p == nullptr) throw bad_any_cast();
return detail::any_cast_move_if_true<ValueType>(p, can_move());
}



Loading…
Cancel
Save