msvc9 express copy/paste issue
Code:
#ifndef SEQUENCE_H
#define SEQUENCE_H
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<cstdio>
#include"typedefs.h"
namespace GT
{
template < uint N >
class Sequence
{
private:
IntVec sequence_;
Sequence( const Sequence& );
Sequence& operator =( const Sequence& );
public:
Sequence()
{
sequence_.reserve( N );
for ( int i = 1; i <= N; ++i )
{
sequence_.push_back( i );
}
Shuffle();
}
const IntVec& GetSequence() const
{
return sequence_;
}
staticvoid Randomize( uint def = 0 )
{
if ( def == 0 )
def = static_cast<uint>( std::time( NULL ) );
std::srand( def );
}
void Shuffle()
{
std::random_shuffle( sequence_.begin(), sequence_.end() );
}
};
} // end namespace
#endif// header guard
The above was pasted from msvc9 express. As you can see this destroys all indentation and even sometimes joins keywords together losing the space between them. What can i do? Others who use msvc9 dont seem to have this problem. I have already told it to use spaces rather than tabs as in all previous versions of msvc I have used. The syntax colouring is nice, but not at the expanse of destroying structure!
Anyone know the fix for this issue??
Also it appears this text is green as the last line of code is a comment. Very strange behaviour.
Re: msvc9 express copy/paste issue
Select all the code (CTRL-A) and press CTRL-Shift-F.
later edit: sorry, it is CTRL-K, F (meaning CTRL-K and then F)
Re: msvc9 express copy/paste issue
Didn't work, that just formatted the code into a style that I dont like and still when pasted same problems occurred. Indentation toally destroyed. Text after still green. This is very annoying.
Re: msvc9 express copy/paste issue
There is not enough detail to really respond. Without seeing the original file and seeing how you pasted it, we can't replicate what you did. I'd be inclined to say the issue is not a vBulletin issue since nobody else seems to be having it......
In looking at the code in your post, you seem to be color coding your text green, etc.
Again, more specifics would be needed to see what is actually happening.
Brad
Re: msvc9 express copy/paste issue
The colour coding is done by msvc not me
This is exactly how it pastes from msvc9 and I swear it doesn't look like that in the compiler.
Code pasted from msvc7.0
Code:
#ifndef SEQUENCE_H
#define SEQUENCE_H
#include <algorithm>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include "typedefs.h"
namespace GT
{
template < uint N >
class Sequence
{
private:
IntVec sequence_;
Sequence( const Sequence& );
Sequence& operator =( const Sequence& );
public:
Sequence()
{
sequence_.reserve( N );
for ( int i = 1; i <= N; ++i )
{
sequence_.push_back( i );
}
Shuffle();
}
const IntVec& GetSequence() const
{
return sequence_;
}
static void Randomize( uint def = 0 )
{
if ( def == 0 )
def = static_cast<uint>( std::time( NULL ) );
std::srand( def );
}
void Shuffle()
{
std::random_shuffle( sequence_.begin(), sequence_.end() );
}
};
} // end namespace
#endif // header guard
Same code pasted from msvc9 express.
Code:
#include <algorithm>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include "typedefs.h"
namespace GT
{
template < uint N >
class Sequence
{
private:
IntVec sequence_;
Sequence( const Sequence& );
Sequence& operator =( const Sequence& );
public:
Sequence()
{
sequence_.reserve( N );
for ( int i = 1; i <= N; ++i )
{
sequence_.push_back( i );
}
Shuffle();
}
const IntVec& GetSequence() const
{
return sequence_;
}
static void Randomize( uint def = 0 )
{
if ( def == 0 )
def = static_cast<uint>( std::time( NULL ) );
std::srand( def );
}
void Shuffle()
{
std::random_shuffle( sequence_.begin(), sequence_.end() );
}
};
} // end namespace
#endif // header guard
Re: msvc9 express copy/paste issue
Hmmm thats wierd. No syntax colouring now. Now I really have no idea whats going on, I havent changed anything in the editor at all.
Re: msvc9 express copy/paste issue
Snippet just posted in last reply but this time from reply to thread
Code:
const IntVec& GetSequence() const
{
return sequence_;
}
staticvoid Randomize( uint def = 0 )
{
if ( def == 0 )
def = static_cast<uint>( std::time( NULL ) );
std::srand( def );
}
void Shuffle()
{
std::random_shuffle( sequence_.begin(), sequence_.end() );
}
Seems conclusive.
Re: msvc9 express copy/paste issue
I confirmed. This is a vBulletin issue. We'll have to report the bug to them.
I've removed some of your testing posts (they should have been done in the testing forum). I've also moved this thread to the feedback forum so that our Forum Manager can see it.
Brad!
Re: msvc9 express copy/paste issue
TYVM Brad.
I expected those posts to be deleted after you had seen them.