CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets for: Matt Calabrese
C++
/*=============================================================================
    Copyright (c) 2011 Matt Calabrese

    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/config.hpp>
 
// ToDo: Add check for relaxed typename rule
by Matt Calabrese   August 06, 2011 @ 1:23pm
142 Views
no comments
 
C++
#include <boost/type_traits/is_arithmetic.hpp>
#include <boost/type_traits/is_pointer.hpp>
#include <boost/utility/enable_if.hpp>
 
namespace boost {
 
// Never defined
extern void* enabler;
 
}
by Matt Calabrese   April 11, 2011 @ 9:42am
1260 Views
no comments
 
C++
using namespace boost::generic::std_concept;
 
struct input_iterator_overload {};
struct bidirectional_iterator_overload {};
struct random_access_iterator_overload {};
 
#define STATIC_ASSERT_IS_SAME( left, right )                                   \
BOOST_STATIC_ASSERT                                                            \
( ( ::boost::is_same                                                           \
    < BOOST_GENERIC_DETAIL_REMOVE_PAREN( left )                                \
by Matt Calabrese   December 15, 2010 @ 12:38pm
Tags:
111 Views
no comments
 
C++
#include <boost/auto_function/auto_function.hpp>
#include <boost/generic/std_concept/iterator.hpp>
#include <boost/generic/type_traits/concept_is_modeled_by.hpp>
#include <cassert>
#include <forward_list>
#include <iterator>
#include <list>
#include <vector>
 
// Just for simplicity of the example, pull in the full namespace
by Matt Calabrese   November 13, 2010 @ 11:21am
240 Views
no comments
 
C++
// Standard reference 24.2.2
// The following code defines the concept "Iterator"
// The concept is uaary with a single type parameter called "X"
// The "using" argument here specifies that "Iterator" is a refinement of the
// previously defined concepts "CopyAssignable", "CopyConstructible",
// "Destructible", and "Swappable".
// The "for typedef" argument is a convenience argument that lets the programmer
// create a simple alias for a more complicated type name. This alias is only for
// use when calling the macro to simplify the specification of further
// requirements.
by Matt Calabrese   November 09, 2010 @ 2:18pm
258 Views
no comments
 
C++
/*==============================================================================
    Copyright (c) 2010 Matthew Calabrese

    Use, modification and distribution is subject to 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)
==============================================================================*/
 
// Note: Currently only tested on GCC 4.5.1
by Matt Calabrese   October 16, 2010 @ 11:13pm
257 Views
no comments
 
C++
// Note: The compiler does not need "requires" or concepts for this to work
//       Also notice that here the predicate is a type
template< class L, class R >
BOOST_AUTO_FUNCTION( add( L left, R right ) )
  ( requires boost::is_pointer< L > )
(
  return left + right // no semicolon, must be an expression
) // Note these are parentheses
 
// Same as above only the predicate is a value
by Matt Calabrese   October 15, 2010 @ 3:48pm
281 Views
no comments
 
C++
#include <new>
#include <utility>
 
// This macro is variadic in order to directly support operator,
#define BOOST_AUTO_FUNCTION( ... ) auto __VA_ARGS__ -> BOOST_AUTO_FUNCTION_IMPL
 
#define BOOST_AUTO_VOID_FUNCTION( ... )                                        \
auto __VA_ARGS__ -> BOOST_AUTO_VOID_FUNCTION_IMPL
 
// Variadic to support expressions with commas not between parentheses
by Matt Calabrese   October 13, 2010 @ 4:22pm
260 Views
no comments
 
C++
#include <boost/preprocessor/control/iif.hpp>
#include <boost/preprocessor/facilities/empty.hpp>
#include <boost/preprocessor/facilities/identity.hpp>
#include <boost/ptr_container/clone_allocator.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp>
#include <utility>
 
#define AUTO_FUN_IMPL( ... ) decltype( __VA_ARGS__ ) { return __VA_ARGS__; }
by Matt Calabrese   October 04, 2010 @ 12:50am
Tags: clone_ptr
247 Views
1 comments
 
C++
#include <utility>
 
// Note: I've revised my implementation of AUTO_FUN here
// to make its use look more like a function definition
 
#define AUTO_FUN_IMPL( ... ) decltype( __VA_ARGS__ ) { return __VA_ARGS__; }
 
#define AUTO_FUN( name_and_param_list ) auto name_and_param_list-> AUTO_FUN_IMPL
 
template< typename SourceType >
by Matt Calabrese   January 27, 2010 @ 9:55pm
477 Views
no comments
 
C++
#include <nds.h>
 
// Explanation:
// The following code shows the problem. There are two allocations each yielding
// different adresses. One memory location is filled with red pixels, the other
// is filled with blue pixels. They are then rendered, however you will see two
// red sprites instead of a red and a blue. The reason is that the second
// allocation is not aligned to the boundaries implied by
// SpriteMapping_Bmp_1d_128 meaning that when the oam stores the memory adresses
// as an offset based on the boundary size, both offsets are truncated to the
by Matt Calabrese   January 17, 2010 @ 11:46pm
209 Views
1 comments
 
C++
#include <nds.h>
 
#include <boost/cstdint.hpp>
#include <boost/gil/algorithm.hpp>
#include <boost/gil/image_view.hpp>
#include <boost/gil/packed_pixel.hpp>
#include <boost/gil/rgba.hpp>
#include <boost/gil/virtual_locator.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/utility/binary.hpp>
by Matt Calabrese   January 05, 2010 @ 3:34pm
703 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate