-
Jan Trávníček authoredJan Trávníček authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
allocFix.hpp 1.62 KiB
/*
* allocFix.hpp
*
* This file is part of Algorithms library toolkit.
* Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
* Algorithms library toolkit is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Algorithms library toolkit is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>.
*
* Created on: Mar 6, 2018
* Author: Jan Travnicek
*/
#ifndef __ALLOC_FIX_HPP_
#define __ALLOC_FIX_HPP_
// related to issue with 'undefined reference to allocator < ... >::allocator ( )', subject of a delete when g++ fixes the issue
// the undefined reference occurs when one inherits from a class whose constructor has default value for the allocator
// I guess the default parameter construction (allocator constructor) should be inlined but it isn't. Its code is not emited either.
namespace ext {
/**
* Class implementing the fix of undefined allocator
*
* TODO test if later versions of g++ are no longer affected.
*/
template < class Alloc >
class AllocFix {
public:
AllocFix ( ) {
// just to make sure the allocator constructor exists
static Alloc alloc;
}
};
} /* namespace ext */
#endif /* __ALLOC_FIX_HPP_ */